PDA

View Full Version : [CLOSED] [4.0.6] Calling getPageData From Unrendered PagingTbar Produces JS Error



ZachG
3 Oct 2011, 12:30 PM
REQUIRED INFORMATION




Ext version tested:

Ext 4.0.6

Browser versions tested against:

Chrome 14

DOCTYPE tested against:

None

Description:

If I try to get the page data from a toolbar that's been unrendered, it gives a js error.

Steps to reproduce the problem:

Copy/paste the code below

The result that was expected:

It would return false or something else.

The result that occurs instead:

It gave a js error

Test Case:




Ext.onReady(function() {
Ext.create("Ext.window.Window", {
width:500,
height:500,
dockedItems:[
{
xtype:"pagingtoolbar",
dock:"bottom",
store:{
proxy:{
type:"memory"
},
model:Ext.define("TestModel", {
extend:"Ext.data.Model",
fields:[]
}) && "TestModel"
}
}
],
listeners:{
afterrender:function() {
var me = this,
bbar = me.dockedItems.findBy(function(inItem) { return inItem.alias == "widget.pagingtoolbar" && inItem.dock == "bottom"; });

setTimeout(function() {
me.close();

setTimeout(function() {
bbar.getPageData();
}, 1000);
}, 2000);
}
}
}).show();
});




HELPFUL INFORMATION

Debugging already done:
It looks like just checking getPageData for this.store's existence isn't enough. Also need to check where it's called from, which is onLoad.

evant
3 Oct 2011, 10:29 PM
It's not because the toolbar is "unrendered", but rather, it's been destroyed. This means it has been unbound from the store and the component has been removed from the ComponentMgr. It essentially no longer exists.

It's not feasible to add checks for every component method to check whether it's been destroyed before trying to access <x> that's gone because of the destruction.