EasyUI Forum
March 28, 2024, 04:45:24 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: How do I select a tab panel component in typescript.  (Read 7522 times)
Swany
Newbie
*
Posts: 44


View Profile Email
« on: January 18, 2018, 11:29:53 AM »

How do I select a tab panel component in typescript after the tabs have created. Like from a button click.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: January 18, 2018, 04:58:21 PM »

Call the 'select' method of TabPanelComponent to select it, or set the 'selectedIndex' of the TabComponent.
Logged
Swany
Newbie
*
Posts: 44


View Profile Email
« Reply #2 on: January 19, 2018, 09:01:45 AM »

Jarry ->I know the documentation say to use those, but I have try both and it is not working. Could you please show me an example so I can see what I am doing wrong?

Let me better explain what I am doing. I am creating a new tab dynamically like your example in https://www.jeasyui.com/forum/index.php?topic=7103.0. (By the way thank you for that!) The problem I am having is the new tab is not selected after it is created. I need to to automatic select the new tab after it is created.
« Last Edit: January 19, 2018, 10:34:00 AM by Swany » Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 on: January 19, 2018, 06:45:10 PM »

Please try this code.
Code:
addTab() {
this.tabs.push({
title: 'New Tab',
content: 'New Content'
});
setTimeout(() => this.selectedIndex = this.tabs.length-1);
}
Logged
Swany
Newbie
*
Posts: 44


View Profile Email
« Reply #4 on: January 23, 2018, 09:57:26 AM »

That works, thanks.
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!