locked
ActiveTabIndex is out of scope at client script because some Tabpanels of TabContainer are set to invisible RRS feed

  • Question

  • User232976756 posted
    I am using TabContainer in an aspx page loaded in an iframe. I meet a strange issue.

    If you set some of Tabpanels invisible, that means the visible count of tabs is not equal to the total count of tabs.
    It seems that at client script, only visible tabs are counted, and if ActiveTabIndex set at server side is out of client scope of tabs, an error is definitely popup.

    Refer to follow code, which is a part of client script of TabContainer,

    for example, there are five tabpanels in TabContainer, 0,1,4 are visible, and ActiveTabIndex is set to 4.
    It works fine with previous Ajaxtoolkit.
    For the newest version of ajaxtoolkit (Dec, 2013), in which TabContainer is rewriten with Jquery,
    _tabs will have only 3 tabpanels, and the opt.activeTabIndex is still 4 (set by and from server side),
    so the underlined row is definitelly the place of issue. because self._tabs[opt.activeTabIndex] is null.

    Could please give a fix for it!


    _setActiveTabIndex: function (value) {
     
                var self = this, opt = self.options;
     
                if (value < -1) {
                    throw "invalid tab index";
                }
     
                if (value >= self._tabs.length) {
                    value = self._tabs.length - 1;
                }
     
                if (!self._created || value != opt.activeTabIndex) {
     
                    if (opt.activeTabIndex != -1) {
                        self._tabs[opt.activeTabIndex]._set_active(false);
                    }


    Sunday, June 22, 2014 1:50 PM

Answers