Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dennis Nederlof on Oct 24, 2008 11:37
open dhtmlx forum
DHTMLX Grid - Default Sorting

I am loading a CSV into a DHTMLX grid. I have a column with a width set to 0 that contains ASCII data, that I want to sort by. I want the data sorted by default after the data is loaded, without the user clicking on anything.

I have tried: grid.setSortImgState(true,INDEX,"asc"); and also various combinations of: mygrid.sortRows(0);

But none seem to work. Any help would be appreciated.
Answer posted by Support on Oct 27, 2008 03:13
If you are loading from remote CSV file|url - the loading is async, so you need to call the sortRows method only after data loaded, it can be done as 

grid.load("some.csv",function(){
    grid.sortRows(0,"str","asc"); //0 - index of column
},"csv");