PDA

View Full Version : Metachange event with GroupingStore



strimp099
8 Sep 2010, 6:00 PM
Greetings all,

I am simply trying to use the metachange event to dynamically load data in from the server. In this case, the metachange event is not even firing (no alerts). Any ideas?




Ext.BLANK_IMAGE_URL = '/bin/js/ext-3.2.1/resources/images/default/s.gif';

Ext.ns('Weekend');



This is the grid (extending a GridPanel):



Weekend.Grid = Ext.extend(Ext.grid.GridPanel, {
initComponent:function() {
var config = {

columns:[]

};

Ext.apply(this, Ext.apply(this.initialConfig, config));

this.store = weekendStore;
this.viewConfig = {forceFit: true};
this.loadMask = true;

this.id = 'weekend';

Weekend.Grid.superclass.initComponent.apply(this, arguments);

this.on({
activate: {scope:this, single:true, fn:function() {
this.store.load({params:{start:0, limit:10}});
}}
});

}

});



...and this is the the GroupingStore:




Ext.reg('weekendGrid', Weekend.Grid);

var weekendStore = new Ext.data.GroupingStore({

url: '/bin/php/do/weekend.do.php',

reader: new Ext.data.JsonReader({
root: 'data',

listeners: {

metachange: function(store, meta) {

var g = Ext.getCmp('weekendGrid');

alert(g);

var cm = g.getColumnModel();

alert(cm);

cm.setConfig(meta.colModel);
g.reconfigure(store, cm);
}
}
}),

sortInfo:{field: 'company', direction: "ASC"},
groupField:'industry',
storeId: 'weekendStore'
});



Any clue on what might be the issue here?