PDA

View Full Version : Problem with the default sorting option....



akdeiva
2 Jan 2007, 10:49 PM
Hi,

i have been trying to set the default colum sort with the dynamic approach, where i would like to changed the sort field name and order passed with different keywords. So i used the baseParams and configured the datamodel with that.

Its working fine when i click the header, whereas, when the load method is called its not using these config values and not sorting or passing these parameters first up.

Here is the code listing ...

this is the config i have for datamodel


this.dataModel.remoteSort = true;
this.dataModel.initPaging(selectorURL, 10);
this.dataModel.setDefaultSort(this.colModel, 1, 'ASC');

this is what i use for sending the params firstup while loading


this.dataModel.on('beforeload', this.getSortCol, this.dataModel, true);

this is the definition of the getSortCol


getSortCol : function(objDataModel, evt) {
alert("I am here first as well");
var baseParams={'sort_field': objDataModel.schema.fields[objDataModel.sortColumn], "sort_order" : objDataModel.sortDir};
grid.dataModel.baseParams = baseParams;
}

Can you tell me what's wrong with this.

Thx