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

Re: [ydn-javascript] Adding tabs from within a tab

Expand Messages
  • Eric Miraglia
    Mike, You should probably set up a click handler on the Tab s content element and use that handler to determine whether the target of the click was the button
    Message 1 of 2 , May 11 10:26 AM
    • 0 Attachment
      Mike,

      You should probably set up a click handler on the Tab's content element and use that handler to determine whether the target of the click was the button of interest.  If it was, then you can take the desired action.  That way, the button need know nothing about whether it's in a Tab or not. ImyTabs is your TabView instance:

      var fnHandleClick = function(e) {
      var clickTarget = YAHOO.util.Event.getTarget(e);
      //now check to see if clickTarget was your button, and act accordingly
      }
      var contentEl = myTabs.getTab(0).get("contentEl"); //returns the DOM reference for the content element of the first tab in myTabs
      YAHOO.util.Event.on(contentEl, "click", fnHandleClick);

      Regards,
      Eric




      ______________________________________________
      Eric Miraglia
      Yahoo! User Interface Library


      On May 8, 2007, at 5:49 PM, Mike Sexter wrote:


      Hi,

       

      I’m looking for a clean way to add a tab to a tabview without an initial reference to the tabview. What I mean is that I have content in a tab and if a certain button in that content is pressed, a new tab should be added to the enclosing tabview. The event generated by the button has no way to reference the tabview, or even the tab, containing it – right?

       

      To further complicate the issue, the tabview in question is actually a set of subtabs appended to the contents of a tab in a ‘higher level’ tabview.

       

      Other than keeping pointers to all the necessary components, are there methods to be called or events to be watched that would give me the references I need?

       

      -          Mike



    Your message has been successfully submitted and would be delivered to recipients shortly.