jQuery UI Widgets Forums Navigation Tabs Change Tab Title

This topic contains 6 replies, has 2 voices, and was last updated by  shimmoril 11 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Change Tab Title #9300

    shimmoril
    Participant

    I’ve got a set of tabs that display content in iframes. When the content is saved, I want to change the title of the tab. I know there’s the setTitleAt method, but I’m not sure how to get the index. Is it possible to get the index from inside the content? Or perhaps just get the index of the active tab?

    I saw the thread about changing tab titles based on the current name, but I may have multiple tabs with the exact same title, so that won’t work for me.

    • This topic was modified 11 years, 7 months ago by  shimmoril.
    Change Tab Title #9323

    Dimitar
    Participant

    Hello shimmoril,

    If you want to get the tab’s position based on its content, this code snippet should do the job:

                var yourContent; // this variable holds the value of the saved content
    var currentContent;
    var tabPosition; // this variable will hold the position of the tab with the saved content
    var tabsCount = $("#jqxTabs").jqxTabs('length');
    for (var i = 0; i < tabsCount; i++) {
    currentContent = $("jqxTabs").jqxTabs('getContentAt', i);
    if (currentContent == yourContent) {
    tabPosition = i;
    $("#jqxTabs").jqxTabs('setTitleAt', tabPosition, "New title of tab");
    break;
    };
    };

    Alternatively, you may get the active tab when you select it. Here is how:

                $("#jqxTabs").bind('selected', function (event) {
    var selectedTab = event.args.item;
    });

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Change Tab Title #9347

    shimmoril
    Participant

    Thanks Dimitar, that works. One thing though – when I rename the tab, I lose the close button. I tried to re-add it via showCloseButtonAt, but it didn’t work.

    Change Tab Title #9432

    Dimitar
    Participant

    Hi shimmoril,

    Thanks for your feedback. We will take the reported issue into consideration.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Change Tab Title #9469

    shimmoril
    Participant

    Dimitar – so are you confirming this is a bug? Do you have an ETA for a possible fix? This is critical functionality for our application.

    Change Tab Title #9503

    Dimitar
    Participant

    Hi shimmoril,

    The issue will be fixed in jQWidget’s next version (2.5). However, we cannot provide you with an exact timeframe for its release.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Change Tab Title #9551

    shimmoril
    Participant

    Thank you Dimitar.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.