View Full Version : Ext JS 4.2 Custom sort for Ext.grid.column.Column

10 Jun 2014, 12:12 PM
I'm using Ext JS 4.2 and I need to be able to set a custom sort for a grid column. I know I can use the sortType function on the model level, but the values have to be sorted from the grid column level since I am using a renderer and the way that the data is displayed in the table is not necessarily the way the model displays it, and the way it is displayed can vary from table to table.

How would I go about doing this?

26 Jun 2014, 6:03 AM
The sorting is on the data level not the view level so you'd have to recreate your renderer in the sortType

20 Jul 2014, 1:41 PM
I have a similar scenario, but using a combo field type - my custom sorter does not get called. Here's the relevent gridcolumn configuration that all works except for the sorting:

text: "Property",
itemId: 'columnPropertyId',
readOnly: false,
hideable: false,
minWidth: 200,
align: 'center',
filter: {
type: 'list',
renderer: function(val) {
var ret = MVRZ.Dataset.getInRecord(MVRZGC.DATASET_PROPERTY, 'name', val);
return ret;
field: {
xtype: 'combo',
typeAhead: true,
editable: true,
forceSelection: true,
hidden: false,
store: MVRZ.Dataset.getStore(MVRZGC.DATASET_PROPERTY),
queryMode: 'local',
displayField: 'name', // When combo is viewed for editing
valueField: 'id',
sortType: function(val) {
// Never called
return MVRZ.Dataset.getInRecord(MVRZGC.DATASET_PROPERTY, 'name', val);

... do I need to do something else here?


20 Jul 2014, 3:02 PM
The sortType goes on the model definition. Docs here: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Field-cfg-sortType

20 Jul 2014, 4:02 PM
Doh - thank you!Not an obvious place for this but it works :)