PDA

View Full Version : Issue with Sorting order of Grid



saurabhsh79
9 Sep 2010, 6:14 AM
I am facing an issue in Grid, that when I sort the grid once and then insert a record in the Strore, I want that after insert the latest record should come as first record.


For this I am using following code:

function selectFirstRecord(){
Ext.getCmp('dataGrid').store.load({
params:{start:0, limit:20, sort:"field_id", dir:"DESC"},
callback: function(){
Ext.getCmp('dataGrid').getSelectionModel().selectFirstRow();
}
}
);

Even though I am passing DESC as direction of data display(to display last inserted record as first, I am using DESC) still it shows records in ASC order. Can Someone help me out to resolve this issue.

Thanks & Regards
Saurabh

jay@moduscreate.com
9 Sep 2010, 6:50 AM
Moved to Ext help forums. Please Post questions here instead of "Open Discussion"

Condor
9 Sep 2010, 7:12 AM
Don't pass sort and dir parameters yourself! Call setDefaultSort and then load the store (assuming you have remoteSort:true).