Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    106
    Vote Rating
    2
    wizkid is on a distinguished road

      0  

    Default [CLOSED]Ext.util.History and unable to hook-up change event

    [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:

    Code:
    me.events is undefined
    [Break On This Error] me.events[ename] = me.events[ename] || true;
    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.

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    37
    Vote Rating
    0
    cntx is on a distinguished road

      0  

    Default


    Try this one

    Code:
    Ext.util.History.on('change', this.HandleHistoryChange, this);

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    106
    Vote Rating
    2
    wizkid is on a distinguished road

      0  

    Default


    I found in the examples this:

    Call in onReady: Ext.History.init();

    Also in my web page I needed:
    Code:
      <form id="history-form" class="x-hide-display">
            <input type="hidden" id="x-history-field" />
            <iframe id="x-history-frame"></iframe>
        </form>
    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?

    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!

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,058
    Vote Rating
    659
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    106
    Vote Rating
    2
    wizkid is on a distinguished road

      0  

    Default


    Thanks for the update! The docs should, at least, get people far enough! Thanks

Similar Threads

  1. Collapse all ComboBox components when Ext.History's change event fires?
    By paulcrowder in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 9 Mar 2011, 1:51 PM
  2. [DEFER-968] Ext.History.add() fires change event
    By cnelissen in forum Ext 3.x: Bugs
    Replies: 8
    Last Post: 29 Jul 2010, 8:55 AM
  3. Ext.History: 'change' event fired on Ext.History.add
    By S1-Gezi in forum Community Discussion
    Replies: 5
    Last Post: 18 Sep 2008, 8:10 AM

Thread Participants: 2