Thank you for reporting this bug. We will make it our priority to review this report.
[CLOSED]Ext.util.History and unable to hook-up change event
I have a object (created in the onReady) that, in it's constructor, hooks up the change event for the History singleton object.
This is how I do it:
Ext.util.History.addListener('change', this.HandleHistoryChange(), this);
In FireBug this is the error I get in ext-all-debug.js:
Maybe I am doing something wrong here? My goal was to hook-up to the history change event so I know when the user clicks that back or forward button on the browser! This is the goal, maybe there it's more involved than just hooking into the change event? It would seem odd since there is already an instance created of History by the time I get into my onReady.
me.events is undefined
[Break On This Error] me.events[ename] = me.events[ename] || true;
Try this one
Ext.util.History.on('change', this.HandleHistoryChange, this);
I found in the examples this:
Call in onReady: Ext.History.init();
Also in my web page I needed:
So, it's working now. I still do not withdraw my bug report as I think the exception I was getting was very unhelpful, and sent me on a wild chase. Can't we have an exception, somewhere, that if you try and hook up the change listener, for History, if you have not called init or don't have the magic form code, that it will tell you this?
<form id="history-form" class="x-hide-display">
<input type="hidden" id="x-history-field" />
The same goes with using the .add method on History. If you don't do the magic setup, anything you do with this Singleton object is problematic? Am I right on that or wrong on that? Also, in the documentation this should be there telling you this!
I've added extra docs that:
a) Say that init() must be called before calling any History operation
b) Specify that the iframe/hidden field are required and have added some suggested markup.
I don't think it makes sense to add exceptions for every method in this specific case, especially since the docs are now much more clear on the matter.
Twitter - @evantrimboli
Don't be afraid of the source code!
Thanks for the update! The docs should, at least, get people far enough! Thanks