Tabbar - Check if tab exists

Hi All,

I’ve created a function to add a new tab to the tabbar with my desired info. This works great, but I want to check if the tab is already open before opening a new one.

function addNewTab(URL,Name,Heading) { var id = Name; tabMenu.enableTabCloseButton(true); tabMenu.addTab(id, Name, "150px"); tabMenu.setHrefMode("iframes"); tabMenu.setContentHref(id, URL); tabMenu.setTabActive(id); dhxLayout.cells("a").setText(Heading); }
Can anybody point me in the right direction?

Cheers.

Hello,

cells method returns tab object by id and null if there isn’t such a tab. So, you may try using it:

if(!tabMenu.cells(id)){
tabMenu.addTab(id, Name, “150px”);

}