PDA

View Full Version : [CLOSED] Setting the initial sorters on a store



gatherworks
2 Mar 2012, 3:30 PM
There does not seem to be a way to set the initial sorters on a store that involves a couple of fields with DESC order.

aconran
2 Mar 2012, 3:39 PM
Maybe you can clarify what you tried?

I just added a Store, added multiple sorters to it and then configured them. Seems to work for me.

gatherworks
2 Mar 2012, 11:57 PM
Maybe I just don't understand how to do it then. :)

Let's say, I want to set this up:
sorters: [ {
property:'nuut',
direction:'DESC'
},{
property:'name',
direction:'ASC'
}]

Since there is no sorters to set in Designer, I have to set defaultSortDirection to "DESC" and sortRoot to "nuut". However, I am not sure how to cope with the 2nd field with Designer.

gatherworks
4 Mar 2012, 10:17 AM
I figured out how to do it... add sorters from the toolbox and do not get distracted by the rest.

Thanks!

aconran
5 Mar 2012, 5:43 AM
Glad to see you figured it out! :)

thomsonzh
12 Jul 2013, 6:21 AM
Could you please give me your sample to to sort the store? I meet same question. Help me! I set store like below code, it is not working. I am using extjs 3.X

var store = new Ext.data.JsonStore({
totalProperty: "results",
url: 'department.aspx?action=read',
root: 'records', remoteSort: true,
fields: ['id', 'department', 'description',
'department',
'division',
'divisionid',
'active'],
sorters: [{
property: 'divisionid',
direction: 'DESC'
},{
property: 'department',
direction: 'ASC'
}]
});

Thanks,
Thomson