View Full Version : Store/Grid Sort

15 Apr 2012, 2:59 AM
i have a grid column with a renderer function that does, for example, "displays data in a crazy way".

since it has a renderer function, doesnt have a dataIndex propertie.
is there a way to allow user to order by this column ?

columns: [
{ header: 'RUN',
renderer : function(v,m,r)
{ return r.get('perRut') ? r.get('perRut')+'-'+r.get('perDig') : "";
width: 100

Ext disables the sort hability for this column.
how do i enable it ? to sort just by perRut store/model field ?
sorting is configured to remote, i just need
1) enable the graphic sort hability (header button and arrows)
2) on press, send to the server perRut property.

im thinking in build a "calculated" RUN field in the model but i really dont want to add new fields to the model for each view that uses my model. because in the server side this column doesnt exists and i almost have no permision to modify the server side service

so is there a way to tell which field needs to be sent to the server to get the sort done, when using a custom render column ?

--- solved :d
on dataIndex can put anything, doesnt need to be a real model field when theres a renderer, for grid render purposes this dataIndex will be ignored, but for sorting will read this dataIndex.

Have to set sortable : true to force grid display this column as sortable and send the dataIndex value to the server.

16 Apr 2012, 7:18 AM
Thank you for the update and solution.