Author Topic: Add data in Column wise  (Read 4180 times)

Ganesh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Add data in Column wise
« on: April 07, 2014, 06:33:39 pm »
How to add Data in Column wise Because i created Dynamic column through the using of following code and i need to enter the data in column wise. So help me.       

$('body').on('click','#addstandardvoyage1',function(e)
      {
        var $grid=$("#poolrules_tab_main");
        var CM = $grid.pqGrid("option", "colModel");
        CM.push({title:'Dynamic Column',align:'center', width:280});
        var DM = $grid.pqGrid("option", "dataModel");
            var data = DM.data;
            var $frm = $("#poolrules_tab_main");
            $grid.pqGrid ( "refresh" );   
            $grid.pqGrid( "refreshDataFromDataModel");
            $("#poolrules_tab_main").pqGrid(obj);   
      });

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Add data in Column wise
« Reply #1 on: April 08, 2014, 12:27:02 am »
dataModel.data is 2 dimensional array or an array of objects.

for ( var i = 0, len = data.length; i < len; i++ ){
  var rowData = data [ i ];
  rowData[ dataIndx ] = new data ; // where dataIndx is dataIndx for new column
}