You can add and close new tab items programmatically at client side.
This topic will show you how to add/close tab in client side.
To add/close tab in client-side
- Drag 2 HTML buttons from the toolbox.
- Create AddNewTab() function to implement adding new tab.
JavaScript
Copy Codevar tabNewIndex = 0; function AddNewTab() { tabNewIndex++; var tab = ISGetObject("WebTab1"); var newItem = tab.AddNewTabItem("WebTab" + tabNewIndex, "WebTab " + tabNewIndex, null); var activeTab = newItem; activeTab.ContentMode = "UseInlineContent"; newItem.SetActive(); // set the newly created tab item as active }
- Create CloseTab() function to implement closing tab items.
JavaScript
Copy Codefunction CloseTab() { var tab = ISGetObject("WebTab1"); var tabItem = tab.GetActiveTab(); tabItem.Close(); }
- Invoke AddNewTab() and CloseTab() using html button onclick event.
<input id="Button1" type="button" value="button" onclick="AddNewTab()" />
<input id="Button2" type="button" value="button" onclick="CloseTab()" />
- Run the project.