EasyUI Forum
May 14, 2024, 01:48:11 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Tab Content by Tree onClick  (Read 8970 times)
ftmh
Newbie
*
Posts: 19


View Profile
« on: August 01, 2014, 11:11:15 PM »

How do i have different content for my tabs dynamically? Huh. i have a tree with some nodes(Form,AddUser,Search), that when click on each node the "addpanel()" function of tab work and make tab,but i have different JSP page, how can i have more than one href for my tab, when i click on tree node the related  jsp page appear in my tab. tnx  Grin





Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 02, 2014, 01:07:20 AM »

When click a tree node, call 'select' method of tabs to make the corresponding tab panel visible.
Code:
$('#tt').tree({
  onClick: function(node){
    $('#tabs').tabs('select', node.title);
  }
});
Logged
ftmh
Newbie
*
Posts: 19


View Profile
« Reply #2 on: August 02, 2014, 02:03:29 AM »

thanks  Wink

I think the title of the tab most the same as jsp name:

Code:
 
var tt= $('#tab').tab('options').title;
function addPanel(node) {  
          index++;
          $('#tab').tabs('add', {
              title: node.text,
href:tt+'.jsp',
              closable: true
          });
      }


it is right?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: August 02, 2014, 07:27:59 AM »

You can use the same name as the node text for your pages.
Code:
$('#tt').tree({
onClick: function(node){
var t = $('#tabs');
if (t.tabs('exists', node.text)){
t.tabs('select', node.text);
} else {
t.tabs('add', {
title: node.text,
href: node.text + '.jsp',
closable: true
})
}
}
})
Logged
ftmh
Newbie
*
Posts: 19


View Profile
« Reply #4 on: August 02, 2014, 10:58:02 PM »

thanks  Smiley it's works
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!