Hello,
I try to define a desc grouper for my store like this :
Code:
Ext.define('FDM.store.Parts', {
extend: 'Ext.data.Store',
model: 'FDM.model.Part',
...
groupers:[{direction:'DESC', property:'type'}],
...
But it doesn't work.
After looking in the Store.js source file, I understand why.
In the decodeGroupers function, if the grouper is not "instanceof" Grouper, it overwrite direction with 'ASC'.
Code:
decodeGroupers: function(groupers) {
...
if (!(config instanceof Grouper)) {
...
Ext.applyIf(config, {
root : 'data',
direction: "ASC"
});
...
Why overwrite the value if this one exist ?
To solve my problem, I extend the constructor method like this :
Code:
constructor: function(config) {
config = Ext.apply({}, config);
config.groupers = [new Ext.util.Grouper({direction:'DESC', property:'type'})];
this.callParent([config]);
}