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

20248Re: TabView activeTabChange event

Expand Messages
  • wmlpez
    Oct 31, 2007
    • 0 Attachment
      I think the following will work now if I figure out the sequence of
      event firing along with the postback events...I keep setting the tab
      index to 0.

      <script type=text/javascript>
      var mTabs = new YAHOO.widget.TabView("models");
      var handleActiveTabChange = function(e) {
      var hdnFieldIdx = document.getElementById("hdnSelectedTab");
      hdnFieldIdx.value = mTabs.get('activeIndex');};
      mTabs.addListener('activeTabChange', handleActiveTabChange);
      function setTabIndex(){
      var selectedIndex = document.getElementById("hdnSelectedTab").value;
      alert('selectedIndex: ' + selectedIndex);
      if (selectedIndex.length == 0){
      mTabs.set('activeIndex',0);
      }
      else{
      mTabs.set('activeIndex', selectedIndex);
      }
      }
      </script>
      --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@...> wrote:
      >
      > I'm making progress but still can not acheive the results I want. I
      > found out calling e.newValue property returns the tab handle and not
      > the index which is why I was getting the error. I can't figure how to
      > get the index of the tabview during the activeTabChange event is fired.
      >
      > --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@> wrote:
      > >
      > > Any takers to set me straight? :-)
      > >
      > > To recap, I'm trying to maintain which tab was selected during each
      > > postback (.Net web app). I'm trying to catch the activeTabChange
      event.
      > >
      > > Here's the js in the page header area. For the <body> onload event I
      > > have it set to call the setTabIndex function but it get a js null
      > > error that I cannot pin point.
      > >
      > > <script type="text/javascript">
      > > var mTabs = new YAHOO.widget.TabView("models");
      > > var handleActiveTabChange = function(e) {
      > > var hdnFieldIdx = document.getElementById("hdnSelectedTab");
      > > hdnFieldIdx.value = e.newValue;};
      > > mTabs.addListener('activeTabChange', handleActiveTabChange);
      > > }
      > > function setTabIndex(){
      > > var selectedIndex = document.getElementById("hdnSelectedTab").value;
      > > alert('selectedIndex: ' + selectedIndex);
      > > var tabView = document.getElementById("models");
      > > if (typeof selectedIndex!=="undefined" && (! isNaN(selectedIndex))
      > ){
      > > tabView.set('activeIndex', selectedIndex);
      > > }
      > > else{
      > > tabView.set('activeIndex',0);}
      > > }
      > > </script>
      > >
      > > --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@> wrote:
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, "wmlpez" <wmlpez@> wrote:
      > > > >
      > > > > Hello. Sorry for the newbie js question. I'm using the
      > > > > tabview in a .net 1.1 web app (maintenence app not my
      > > > > doing). The issue I have is after a postback is
      > > > > complete the page resets the activeTabIndex. How do I restore
      > the tab
      > > > > to the selected tab before the postback( using the activeTabChange
      > > > > event)? I'm not sure how to wire the event. I was thinking that
      > during
      > > > > the firing of the activeTabChange event I would set a hidden field
      > > > > with the tab index then during the page load read the hidden field
      > > > > then set focus to the proper tag. I'm open to any suggestions to
      > > > > accomplish this in the most elegant manner (code snippets most
      > > > > appreciated :-).
      > > > >
      > > > > Thanks,
      > > > > -Will
      > > > >
      > > >
      > > > I have an half baked solution...still working out the kinks.
      > > >
      > >
      >
    • Show all 6 messages in this topic