-
2 Oct 2007 7:16 AM #11
Possible solution
Possible solution
I am not sure, but I think that should work

While creating a reader (I'll take for this example XmlReader) object, you have to pass recordType parameter. There you specify list of your names, e.g., and this later is passed to Ext.data.Record.create(), according to the docs. And on its documentation there is a config option "sortDir". So if you pass not only the name, but configuration options too, then it should work:Code:[ 'col1, 'col2', 'col3' ]
I think I have tried that, but I am not sure anymoreCode:[ {name: 'col1', sortDir: 'DESC'}, 'col2', 'col3' ]
Try and see 
-
4 Oct 2007 12:39 AM #12
-
4 Oct 2007 10:24 AM #13
-
7 Mar 2012 6:33 AM #14
and what about extjs 4? how do you achieve the same result?
thanks!
-
8 Mar 2012 2:52 PM #15
You should probably post 4.0 topics in 4.0 threads, but here is an override that is your solution that I just made:
then in your column config just add the extra attribute oppositeSort: true and it will do what you want.Code:Ext.override(Ext.grid.column.Column, { oppositeSort: false, toggleSortState: function() { var me = this, idx, nextIdx; if (me.sortable) { idx = Ext.Array.indexOf(me.possibleSortStates, me.sortState); if(this.oppositeSort && idx == -1) idx = 0; nextIdx = (idx + 1) % me.possibleSortStates.length; me.setSortState(me.possibleSortStates[nextIdx]); } } });



Reply With Quote