EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: ftmh on August 01, 2014, 11:11:15 PM



Title: Tab Content by Tree onClick
Post by: ftmh on August 01, 2014, 11:11:15 PM
How do i have different content for my tabs dynamically? ???. 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  ;D







Title: Re: Tab Content by Tree onClick
Post by: stworthy 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);
  }
});


Title: Re: Tab Content by Tree onClick
Post by: ftmh on August 02, 2014, 02:03:29 AM
thanks  ;)

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?


Title: Re: Tab Content by Tree onClick
Post by: stworthy 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
})
}
}
})


Title: Re: Tab Content by Tree onClick
Post by: ftmh on August 02, 2014, 10:58:02 PM
thanks  :) it's works