Dhtmlx grid Sort

Iam using the F-12 key to add a new row to the grid. I would like to sort the grid on the date column whenever a new row is added. How can this be done?

mygrid.attachEvent(“onRowAdded”,function(){
    mygrid.sortRows(INDEX)
    return true;
})

where INDEX - index of column in question

I actually want to sort the grid based on the submission date and submission time and these are two columns in the grid. Can this be done? 

You can use complex custom sorting function or just the next approach

mygrid.attachEvent(“onRowAdded”,function(){
    mygrid.enableStableSorting(true);
    mygrid.sortRows(INDEX_time,“str”,“asc”);   // sort by lesser value
    mygrid.sortRows(INDEX_date,“str”,“asc”);   // sort by higher value
    return true;
})


grid_sort_two_columns.zip (1.73 KB)