PDA

View Full Version : [B3] Cannot seem to relay the load event from store to grid



slemmon
23 Feb 2012, 7:25 AM
In B3 I'm unable to relay a grid's store's load event to the grid. Was working ok in B2.


Ext.onReady(function () {
var grid = Ext.widget('gridpanel', {
title: 'My Grid'
, height: 200
, width: 200
, renderTo: Ext.getBody()
, columns: [{
text: 'Header Text'
, dataIndex: 'foo'
}]
, store: {
fields: ['foo']
, proxy: {...}
, listeners: {
load: function () {
console.log('store handled load event')
}
}
}
, listeners: {
beforerender: function (grid) {
grid.relayEvents(grid.getStore(), ['load']);
}
, load: function () {
console.log('grid handled load event')
}
}
});
});

mitchellsimoens
23 Feb 2012, 7:31 AM
I did this with beta3:


var grid = new Ext.grid.Panel({
title: 'My Grid'
, height: 200
, width: 200
, renderTo: Ext.getBody()
, columns: [{
text: 'Header Text'
, dataIndex: 'title'
}]
, store: {
fields: ['foo']
, proxy: {
type : 'ajax',
url : 'data/json.json'
}
, listeners: {
load: function () {
console.log('store handled load event')
}
}
}
, listeners: {
beforerender: function (grid) {
grid.relayEvents(grid.getStore(), ['load']);
grid.getStore().load();
}
, load: function () {
console.log('grid handled load event')
}
}
});

And I got these console logs:

32064

slemmon
23 Feb 2012, 7:35 AM
Ok. Let me do some more digging. I abstracted that sample code from an existing project that is failing when I use the B3 library, but works when I move back to B2. I'll see if I can isolate a better test case.

Thx

slemmon
23 Feb 2012, 9:27 AM
I think I was able to root cause the issue I was seeing. Opened a distinct thread for the issue to make it easier to find/comment.

http://www.sencha.com/forum/showthread.php?182893-B3-Component-render-afterrender-beforerender-handlers-in-controller.Control