Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    tab.title returning original title, not current title

    I am having trouble retrieving the current title for a tab in my tabset. My tabs initially have a title of "Loading..." and then once the content of the tab has finished loading, I call tabset.setTabTitle() to update the title to reflect the content that was loaded.

    The problem, is that later during the tabSelected event, if I try to retrieve the tab title using tab.title, I get the original "Loading..." instead of what is currently displayed in the visible tab title.

    Is there another method for retrieving the title, or am I setting it incorrectly? I'm stumped... thanks!

    #2
    Can you show a test case for this? This doesn't look possible from how the code for setTabTitle works.

    Comment


      #3
      Example

      Here is the function that creates the new tab and initially sets the title to "Loading..." - it also sets the close icon to an animated loading GIF:

      function initiateSingle(winNum, id)
      {
      eval("var win = winNum_" + winNum);
      eval("var ts = tabSet_" + winNum);
      var t = ts.addTab({
      title: "Loading...",
      canClose: true,
      closeIcon: "../Images/Progress/circle2.gif"
      });
      ts.selectTab(t);
      PostBackCall("SingleLoad|" + win.title + "|" + winNum + "|" + id);
      }

      The last line initiates an AJAX postback that retrieves the content for the tab. The following is the code that is run once the postback responds:

      function loadSingle(s)

      Comment


        #4
        Example... cont

        Sorry, posted by mistake... here is the function I was starting to type:

        function loadSingle(s)
        {
        singleNum = s[3];
        eval(s[4]);
        eval("var ts = tabSet_" + s[1]);
        eval("var stt = singleTabTitle_" + singleNum);
        eval("var w = winNum_" + s[1]);
        ts.updateTab(ts.tabs.length - 1,
        isc.ViewLoader.create({
        autoDraw:false,
        viewURL: "../" + w.title + "/Single.js",
        loadingMessage: "Loading " + formatSingular(w.title) + "..."
        })
        );
        ts.setTabTitle(ts.tabs.length - 1, stt);
        ts.getTab(ts.tabs.length - 1).setIcon("[SKIN]/TabSet/close.png");
        }

        So this function successfully loads the content into the tab pane with the viewloader, and sets the tab title with the ts.setTabTitle line.

        Finally, here is my tabSet code that includes the tabSelected function that is returning the wrong title:

        isc.TabSet.create({
        ID:"tabSet_" + winNum,
        autoSize:true,
        tabSelected: function(tabNum, tabPane, ID, tab)
        {
        updateOpenWindowLink(this.ID.replace("tabSet_",""), tab.title);
        }
        });

        Comment


          #5
          Example... cont

          It would take a little time for me to get a live example on the web that you could play with... but essentially, if I put a simple line of code that says:

          alert(tab.title)

          in the tabSelected function, it always returns "Loading..." (the initial value of the tab) even though the tab title says something different because it was successfully updated as part of the postback result.

          Comment


            #6
            Instead of counting on the tab's title to manage the state, I would suggest you add another property. Not only will that work around being able to fetch the current title but it also is more clear in the intent.

            Comment


              #7
              Thanks - I'll give that a try

              Comment

              Working...
              X