EasyUI Forum
April 26, 2024, 02:26:06 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: dynamic change of tab panel title  (Read 11031 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« on: April 17, 2014, 07:07:44 AM »

I would change a tab panel title dynamic. How can i do this?

The following code is not working:

Code:
var tab = $(_tabId).tabs('getTab', 2);
tab.panel('setTitle', 'testtitle');
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 17, 2014, 07:18:27 AM »

Please use 'update' method instead.
Code:
var tab = $(_tabId).tabs('getTab', 2);
$(_tabId).tabs('update', {
  tab: tab,
  options: {
    title: 'testtitle'
  }
});
Logged
mshaffer
Newbie
*
Posts: 21


View Profile
« Reply #2 on: December 15, 2016, 08:50:55 PM »

Yes, it seems like setTitle should have worked, but it doesn't ...


Code:
function setTabTitle(selector,index,newTitle)
{
var tab = $(selector).tabs('getTab', index);
$(selector).tabs('update', {
  tab: tab,
  options: {
title: newTitle
  }
});
}


Usage: 
Code:
setTabTitle("#tt",2,"testtitle");

Could easily be updated into the system as a new method...

Logged
mshaffer
Newbie
*
Posts: 21


View Profile
« Reply #3 on: December 15, 2016, 09:02:40 PM »

It seems like if I create tab panel via HTML I can place image elements in the title...

https://assets.mypatentideas.com/images/loading/decagon.gif

Code:
<div id="idea-tab-subset" class="ideaTabs" title=" <IMG class='tabimage' src='{ASSETS}/images/loading/decagon.gif' height=20 /> Subset Analysis" data-options="disabled:false" style="padding:10px; display:none;">

How do I access the element via jquery to show/hide or change attribute source?

Notice the class "tabimage" ... does easyui append title using $(str)?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: December 15, 2016, 11:52:05 PM »

Please use this code to change the 'src' attribute of the image.
Code:
var p = $('#tt').tabs('getTab',0);
var img = p.panel('options').tab.find('.tabimage');
img.attr('src', ...);

The simplest way to set the tab title is to call the 'update' method, please try this code:
Code:
var tab = $('#tt').tabs('getTab', 0);
$('#tt').tabs('update', {
  tab: tab,
  type: 'header',
  options: {
    title: '<img src="..."/>testtitle'
  }
});
« Last Edit: December 15, 2016, 11:57:11 PM by stworthy » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!