PDA

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



brondsem
26 Jan 2007, 7: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
6 Feb 2007, 11:22 AM
this works really well. thanks

prophet
18 Feb 2007, 4: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.