Execute function afterTabClick or afterTabLoad


I need to execute a function after I click on a tab.
Each tab has his content already loaded, but when I change from one tab to the other, I need to execute a function.

How could i do this? Thanks :wink:


please check the following:
docs.dhtmlx.com/api__refs__dhtml … vents.html

I already use the ‘onTabClick’ event.
The problem is that i need to resize an element that is in there.
So I need to execute a function once the content is loaded (and not ‘onTabClick’).



please clarify your question

Ok, sorry if my question was confusing.

I have some HTML elements in the tabs views that I need to resize when they become visible to the user.

My problem is that when I click on a tab, I can’t execute the resize function until the content is loaded. ( I can not execute this function in the ‘onTabClick’ event because i need the content to be already loaded).

I temporarily solved the problem with a setTimeout(myFunction,1000) in the ‘onTabClick’ event function.

So can i execute my function somehow afterTabClick or after the content is loaded?
Can i know when the content is loaded?


What kind of content? dhtmlx component, url (iframe mode), url-ajax, 3rd party or other?

Just some HTML inputs and divs that i need to resize.


that’s correct, onTabClick fired before tab DOM becomes visible. so your way via timeout is correct, 1 microsecond should be enough (if is not ajax/ifarme content)


Thanks for your quick replies.
For now i will keep using the setTimeout, but there is no better solution? or any native dhtmlxTabbbar solution ?

Thanks :wink:

I agree this is not very good solution but we should keep backward compatibility.