Loading ...
Sorry, an error occurred while loading the content.

Tabview - receive notification when the currently selected tab is selected again

Expand Messages
  • stergios_marinopoulos
    I would like to receive an event when the currently selected tab is selected again. Basically I need to work around the behavior in the activate method in
    Message 1 of 3 , Apr 1, 2008
    • 0 Attachment
      I would like to receive an event when the currently selected tab is
      selected again.

      Basically I need to work around the behavior in the activate method in
      TabView.js where suppression of the activeTabChange occurs:


      if (this == self.get('activeTab')) {
      silent = true; // dont fire activeTabChange if already active
      }


      From looking at the code in TabView.js, my initial thought is to chain
      on to the 'activationEvent' with my own listener. Before I go running
      off into that adventure, I thought I would ask here for some advice on
      how to proceed.


      Thanks in advance.


      Stergios Marinopoulos
      http://vlane.com
    • Matt Sweeney
      ... Hi Stergios, You can listen for the activeChange event at the tab level. This always fires, currently active or not. Keep in mind that it also sets the
      Message 2 of 3 , Apr 1, 2008
      • 0 Attachment
        stergios_marinopoulos wrote:
        > I would like to receive an event when the currently selected tab is
        > selected again.
        >
        Hi Stergios,

        You can listen for the "activeChange" event at the tab level. This
        always fires, currently active or not. Keep in mind that it also sets
        the active state to false, so you'll have to branch on the value if you
        are only interested in when active.

        For example:

        var onActiveChange = function(e) {
        if (e.newValue === true) {
        alert('tab "' + this.get('label') + '" activated');
        }
        };

        var tabview = new YAHOO.widget.TabView('demo');
        YAHOO.util.Dom.batch(tabview.get('tabs'), function(tab) {
        tab.on('activeChange', onActiveChange);
        });

        Matt
      • stergios_marinopoulos
        Perfect! Awesome! Worked like a charm. Thanks Matt, Stergios Marinopoulos http://vlane.com
        Message 3 of 3 , Apr 2, 2008
        • 0 Attachment
          Perfect! Awesome! Worked like a charm.

          Thanks Matt,

          Stergios Marinopoulos
          http://vlane.com

          --- In ydn-javascript@yahoogroups.com, Matt Sweeney <msweeney@...> wrote:
          >
          > stergios_marinopoulos wrote:
          > > I would like to receive an event when the currently selected tab is
          > > selected again.
          > >
          > Hi Stergios,
          >
          > You can listen for the "activeChange" event at the tab level. This
          > always fires, currently active or not. Keep in mind that it also sets
          > the active state to false, so you'll have to branch on the value if you
          > are only interested in when active.
          >
          > For example:
          >
          > var onActiveChange = function(e) {
          > if (e.newValue === true) {
          > alert('tab "' + this.get('label') + '" activated');
          > }
          > };
          >
          > var tabview = new YAHOO.widget.TabView('demo');
          > YAHOO.util.Dom.batch(tabview.get('tabs'), function(tab) {
          > tab.on('activeChange', onActiveChange);
          > });
          >
          > Matt
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.