Tab Close Button doesn't work

Hi all,

I’m trying to add close button on my tabs and I’ve noticed some strange behaviour not corresponding to the API reference.

1) I’ve implemented the tabbar.setOnTabClose() to handle tab closure event, but in my app, I have a special tab that should never close and so, in this case, in the setOnCloseFunction, if user try to close my special tab, function should return false to skip tab closure, right? API reference says that.

Unfortunately, even if I return false, I cannot avoid the tab closure as I expected.

2) Other issue, as I said, I have a special tab that never close, and so, I’d like to not show on it the close icon, avoiding tab closure for only that tab. As reported on documentation about the enableTabCloseButton method:

“…mode will be applied to the tabs created AFTER command”

And so, I tried to call enableTabCloseButton method, after special tab creation, but this generated the following javascript error:

tab.childNodes[2].childNodes[this._TabCloseButton ? 1 : 0] is undefined

dhtmlxtabbar.js (riga 1904)

Any hint about close button correct usage?

Thanks in advance and best regards



the onTabClose event doesn’t allow to block closing. In order to enable this feature you should make a small modification in the dhtmlxtabbar.js:

please locate line


and replace it with


Exactly the same problem I am asked, but I would not change
the js file. Is there any other solution without changing the js file?

Thank you.
A greeting.

Hi Alvaro,

I’m also didn’t changed js sources as suggested…

Here it is my workaround:

I’ve added an html image near tab label and added an onclick on it that calls the tab closure dhtmlx method.

In this way, by code, I’m able to decide for each tab if put close action or not.
The only problem in this approach is that if you have active focus on tab A and you click on close button on tab B, the first click take you to tab B and so it need a second click to effectively close tab B.

Hope this can help you,
best regards