Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Babu on Aug 12, 2008 07:17
open dhtmlx forum
Grid Sort by Column on loading

Hi,

I want to sort a grid which has a column of type date.
I don't want to sort the column on clicking the header. I am disabling it.
Just after loading the grid with all the records, I want to sort the grid once according to the date column.

Please help me with this.

Thank u,

Babu
Answer posted by Support on Aug 12, 2008 07:29

mygrid.loadXML(url,function(){
     mygrid.sortRows(1,"date","asc");
});

Where 1 - index of column

Answer posted by Babu on Aug 12, 2008 07:52
Hi,

I can do that way to sort the grid records by column, but here I am not loading the records from a xml file or from some url. So after init() I want to sort the records by date column in ascending order.

Guide me through this.

Thank you for the reply.
Answer posted by Support on Aug 12, 2008 08:09
Just call sortRows in necessary place, 

grid.init();
grid.addRow(...
...
grid.sortRows(index,type,order);