Use sorted vales from store for ListMenu
I was frustrated that the ListMenu wasn't using the configured store's sorted values... so I fixed it:
Change ListMenu.js : in the onLoad function (line 116-ish).
Change:
PHP Code:
for(var i=0, len=records.length; i<len; i++){
var item = new Ext.menu.CheckItem({
text: records[i].get(this.labelField),
group: gid,
checked: this.selected.indexOf(records[i].id) > -1,
hideOnClick: false});
item.itemId = records[i].id;
item.on('checkchange', this.checkChange, this);
this.add(item);
}
To:
PHP Code:
store.each
(
function(rec)
{
var item = new Ext.menu.CheckItem
({
text: rec.get(this.labelField),
group: gid,
checked: this.selected.indexOf(rec.id) > -1,
hideOnClick: false
});
item.itemId = rec.id;
item.on('checkchange', this.checkChange, this);
this.add(item);
},
this
);
Basically the store's onLoad calls the filter's onLoad, but the filter's onLoad was using the raw store records. I changed it to use the store object directly which would already have the sorting done by that point (applySort is called before onLoad is fired).
This only uses the store's default sort (when sortInfo is defined). It does not change the menu if the store is re-sorted... if you want that, you'd probably need to have the filter listen for the store's dataChanged event and call the filter's onLoad again to re-create the menu.