jQuery UI Widgets › Forums › Navigation › Tabs › Change Tab Title
Tagged: close button, content, jqxTabs, tab title, Tabs
This topic contains 6 replies, has 2 voices, and was last updated by shimmoril 11 years, 11 months ago.
-
AuthorChange Tab Title Posts
-
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.
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,
DimitarjQWidgets team
http://www.jqwidgets.com/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.
Hi shimmoril,
Thanks for your feedback. We will take the reported issue into consideration.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/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.
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,
DimitarjQWidgets team
http://www.jqwidgets.com/Thank you Dimitar.
-
AuthorPosts
You must be logged in to reply to this topic.