PDA

View Full Version : Grid: Post column name (not just id) in remote sort


brondsem
01-26-2007, 10:15 AM
In a grid, if you're doing remote paging and sorting, the POSTs only contain the column ID of the sortColumn. Here's how you can add the column name to the POST parameters (until grid 2.0 comes out which sounds like it'll have better column name support):

dataModel.createParams_original = dataModel.createParams;
dataModel.createParams = function(pageNum, sortColumn, sortDir){
params = dataModel.createParams_original(pageNum, sortColumn, sortDir);
params['sortColumnName'] = dataModel.schema.fields[sortColumn];
return params;
};

BernardChhun
02-06-2007, 02:22 PM
this works really well. thanks

prophet
02-18-2007, 07:01 PM
I made this work with the XMLDataModel by changing :
params['sortColumnName'] = dataModel.schema.fields[sortColumn];

To this:
params['sortColumnName'] = dataModel.getFieldName(sortColumn);

It should also be noted that I'm using the yui-ext.0.40-alpha release.