PDA

View Full Version : List rendering in Ext.util.History 'change' event handler throws errors



9 Aug 2012, 10:19 AM
I am using Ext.util.History to allow users to intuitively use the Browser's 'back' button.
My application shows a list of items, and allows the user to select an item to edit it.
When they're editing an item, pressing the Back button will invoke code that renders the list of items.
The code that renders the list of items works fine when executed in the Browser's javascript console, but when it's executed in a function that overrides the History 'change' event (when the Back button is pressed), I get errors on the last line of the code:


...
Ext.getCmp('center-panel').removeAll(true);
Ext.getCmp('center-panel').items.add(panel);
Ext.getCmp('center-panel').doLayout();


The errors are:
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 ext-all-debug.js:15681
Uncaught TypeError: Cannot call method 'getRange' of null

It seems like a timing problem, because it only happens when the function is run in response to the Back button, and not if I execute the code at any other time.

Any hints what I should try in order to fix this?