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

Tabview and Javascript

Expand Messages
  • arminfritsch
    Hi i am trying to build a small application with tabview. the creation of the tabs works well, but i have a problem. i have a tab that i have to reload with
    Message 1 of 4 , Apr 3 9:36 AM
      Hi

      i am trying to build a small application with tabview.

      the creation of the tabs works well, but i have a problem.
      i have a tab that i have to reload with different data

      i tried it that way:
      i delete the tab and then load a new tab.
      this works too

      but, i can not work anymore with my javascript funtions on the new
      tab. the listener does not react anymore

      meineTabs.addListener('contentChange', handler,true);

      meineTabs is just a variable for getTab(1)

      so my question:
      why does the javascirpt works at the beginning but not after reloading?
    • Nick Fitzsimons
      ... If you create a tab, set a variable to contain a reference to it, then delete the tab, the variable will contain a reference to the deleted tab. When you
      Message 2 of 4 , Apr 3 10:22 AM
        On 3 Apr 2007, at 17:36:24, arminfritsch wrote:

        > Hi
        >
        > i am trying to build a small application with tabview.
        >
        > the creation of the tabs works well, but i have a problem.
        > i have a tab that i have to reload with different data
        >
        > i tried it that way:
        > i delete the tab and then load a new tab.
        > this works too
        >
        > but, i can not work anymore with my javascript funtions on the new
        > tab. the listener does not react anymore
        >
        > meineTabs.addListener('contentChange', handler,true);
        >
        > meineTabs is just a variable for getTab(1)
        >
        > so my question:
        > why does the javascirpt works at the beginning but not after
        > reloading?
        >


        If you create a tab, set a variable to contain a reference to it,
        then delete the tab, the variable will contain a reference to the
        deleted tab. When you create your new tab, you need to set your
        variable again, to contain a reference to the new tab.

        In other words, when you execute:

        var meineTabs = meineTabView.getTab(1);

        the getTab function will execute and return a reference to the tab
        that's currently at position 1; this reference is stored in
        meineTabs. If you then remove the tab at position 1, and put a new
        tab there, meineTabs doesn't have any way of knowing what you've
        done, and will carry on holding a reference to the tab that is no
        longer part of the tabView.

        HTH,

        Nick.
        --
        Nick Fitzsimons
        http://www.nickfitz.co.uk/
      • arminfritsch
        ... Hi now i tried the following: myTabs.removeTab(myTabs.getTab(1)); myTabs.addTab(new YAHOO.widget.Tab({ label: strangelabel , dataSrc:
        Message 3 of 4 , Apr 3 11:26 AM
          --- In ydn-javascript@yahoogroups.com, Nick Fitzsimons <nick@...> wrote:
          >
          >
          >
          >
          > If you create a tab, set a variable to contain a reference to it,
          > then delete the tab, the variable will contain a reference to the
          > deleted tab. When you create your new tab, you need to set your
          > variable again, to contain a reference to the new tab.
          >
          > In other words, when you execute:
          >
          > var meineTabs = meineTabView.getTab(1);
          >
          > the getTab function will execute and return a reference to the tab
          > that's currently at position 1; this reference is stored in
          > meineTabs. If you then remove the tab at position 1, and put a new
          > tab there, meineTabs doesn't have any way of knowing what you've
          > done, and will carry on holding a reference to the tab that is no
          > longer part of the tabView.
          >
          > HTH,
          >
          > Nick.
          > --
          > Nick Fitzsimons
          > http://www.nickfitz.co.uk/
          >

          Hi

          now i tried the following:
          myTabs.removeTab(myTabs.getTab(1));

          myTabs.addTab(new YAHOO.widget.Tab({
          label: 'strangelabel',
          dataSrc: '../../strangepathinfo',
          cacheData : false


          }),1);
          meineTabs = myTabs.getTab(1);


          but it still does not work ... i think now my reference should be ok
          ... but nothing happens
        • arminfritsch
          so... after a while of thinking and a short nap i tried it this way and it works (but i do not know why) ... myTabs.addTab(new YAHOO.widget.Tab({ label:
          Message 4 of 4 , Apr 3 11:49 PM
            so...

            after a while of thinking and a short nap i tried it this way and it
            works (but i do not know why) ...

            myTabs.addTab(new YAHOO.widget.Tab({
            label: 'Bilder editieren speichern',
            dataSrc: '../../module/pic_manager_new/index.php?andAlsoDir=2006',
            cacheData : false


            }),1);
            meineTabs = myTabs.getTab(1);

            myTabs.set('activeIndex',1); //setzte das Bild ändern auf aktiv
            meineTabs.addListener('contentChange', handler,true);


            so i add a new listener to the tab ... but it is the same listener
            that is there at the beginning ... why do i have do add this listener
            again ??
          Your message has been successfully submitted and would be delivered to recipients shortly.