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

Re: TabView changing tabs programmatically

Expand Messages
  • bretlevy
    This might help: http://yuihelp.levycodev.com/demos/tabview/change_tabs_via_code.php ~~bret
    Message 1 of 4 , Jun 30, 2009
    • 0 Attachment
      This might help:

      http://yuihelp.levycodev.com/demos/tabview/change_tabs_via_code.php

      ~~bret


      --- In ydn-javascript@yahoogroups.com, Brian McCullough <bdmc@...> wrote:
      >
      > All,
      >
      > I thought that I was going to get this from the documentation, but I
      > guess I can't read.
      >
      >
      > I have a TabView defined like:
      >
      > var myTabs = new YAHOO.widget.TabView( "th_navblock" );
      >
      > and several tabs defined like:
      >
      > YAHOO.plugin.WizardManager.delegate( new YAHOO.widget.Tab({
      > label: 'This',
      > cacheData: true,
      > active: false,
      > dataSrc: 'this.php'
      > }), myTabs, {
      > });
      >
      >
      > YAHOO.plugin.WizardManager.delegate( new YAHOO.widget.Tab({
      > label: 'That',
      > cacheData: true,
      > active: true,
      > dataSrc: 'that.php'
      > }), myTabs, {
      > });
      >
      >
      > YAHOO.plugin.WizardManager.delegate( new YAHOO.widget.Tab({
      > label: 'The Other',
      > cacheData: true,
      > active: false,
      > dataSrc: 'other.php'
      > }), myTabs, {
      > });
      >
      >
      > When Firefox has finished drawing the page, I can do an alert like:
      >
      > alert( "myTabs = " + myTabs );
      >
      > and get a reasonable answer.
      >
      > However, when I am sitting in the original "default" tab, "That", which
      > is configured as "active: true", I do an alert that says:
      >
      > alert( "active = " + myTabs.activeIndex );
      >
      > and I get "undefined".
      >
      >
      > What I want to do is to calculate a new index and call
      > myTabs.selectTab() to go to the new tab.
      >
      > Am I not understanding activeIndex, or is it somehow not valid in this
      > context?
      >
      >
      >
      > Thanks,
      > Brian
      >
    • Brian McCullough
      ... Thank you for the example, Bret. That looks a lot like the older version of what I am trying to do, where I have built the TabView on HTML Markup.
      Message 2 of 4 , Jun 30, 2009
      • 0 Attachment
        On Tue, Jun 30, 2009 at 07:35:52PM -0000, bretlevy wrote:
        >
        > This might help:
        >
        > http://yuihelp.levycodev.com/demos/tabview/change_tabs_via_code.php

        Thank you for the example, Bret.


        That looks a lot like the older version of what I am trying to do, where
        I have built the TabView on HTML Markup.

        Unfortunately, I am trying to do the same thing without the HTML Markup,
        but using JavaScript exclusively ( except for the Div to anchor things
        to ).

        I thought that I could read the activeIndex variable and know what the
        Current Tab was.


        Brian
      • Brian McCullough
        ... It turns out that there seems to be an issue with activeIndex. However, activeTab does have the correct value. var aTab = TabView.get( activeTab ); var
        Message 3 of 4 , Jun 30, 2009
        • 0 Attachment
          On Tue, Jun 30, 2009 at 04:17:17PM -0400, Brian McCullough wrote:
          >
          >
          > Unfortunately, I am trying to do the same thing without the HTML Markup,
          > but using JavaScript exclusively ( except for the Div to anchor things
          > to ).
          >
          > I thought that I could read the activeIndex variable and know what the
          > Current Tab was.


          It turns out that there seems to be an issue with activeIndex. However,
          activeTab does have the correct value.


          var aTab = TabView.get( 'activeTab' );
          var aIdx = TabView.getTabIndex( aTab );
          TabView.selectTab( aIdx );

          gives me what I needed


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