Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by kunal on Dec 15, 2008 03:47
open dhtmlx forum
sorting and paging in grid

please try to remove "myGrid.enableSmartRendering(true);"  from used initialization

as per your reply ,
I have removed myGrid.enableSmartRendering(true); in my code..
the error is resolved now.

Please tell me how do I enable sorting in mygrid..?

My code is as follows

var myGrid=new dhtmlXGridFromTable(tableId);
myGrid.attachHeader(filterstr);
myGrid.enablePaging(true,noOfRecords,noOfPages,"recinfoArea",true);
myGrid.setPagingSkin("bricks");
myGrid.changePage(0);




Answer posted by Support on Dec 15, 2008 05:43
Just add setColSorting command to define sorting types for each column

var myGrid=new dhtmlXGridFromTable(tableId); 
myGrid.setColSorting("str,str,...."); //parameter - comma separated list of sorting types for each column 
myGrid.attachHeader(filterstr);


Instead of using separate js command, you can define column types as part of source html table, you can use sort attribute for header row of table
<table ...
   <tr>
            <td type="ro" sort="str">Header1</td>
            <td type="ed" sort="int">Header2</td>
   </tr>