Tabbar deficiency: No beforeChange event ... looking for help!

While most of the DHX components have very robust event handling, the Tabbar does not. Without a beforeChange event I do not know how we are to control something basic like watch for an edit within a tab page and disallow a Tab Change until a save function is evoked. My programming skills may not be that strong so maybe I am missing something but how – if the change event fires AFTER the change has already occurred – how can I programmatically stop the Tab Change from happening? Does anyone have a solution for this? Any creative solutions will be appreciated. Thank you!

Even on the DHX KB page, people are complaining about this missing feature.

Please DHX, add a beforeChange event to your offering!

Would be great if the future implementation of the beforeChange event could use the return value of the callback to determine if the change is able to occur (true or undefined to perform the change or false to stop the action)

Without a beforeChange event, I was forced to take a different approach. When an ‘edit’ occurs on a Tab Page, I am looping through all non-active Tabs and disabling them. Then, when the User saves any edits, I loop through and re-enable them. It works but it seems clumsy. Any input on a different or better way is welcomed.

Here is my code to disable Tabs:

if(tab_page_changed == true) {
let active = tabbar.getActive();
tabbar.forEach(function(tab) {
if(tab.config.id != active) {
tabbar.disableTab(tab.config.id);
}
});
}

Hi @ND_Results :vulcan_salute: , good news, the current version now supports beforeChange event. :clap::clap:

1 Like

It would be NICE if the DHX docs reflected this … the Tabbar page ONLY shows three events and beforeChage is NOT one of them!

Docs are updated. Try to refresh your browser’s cache.

:vulcan_salute:

1 Like

You are right! Must have just happened? Regardless, this new event is long overdue and VERY welcomed. Thanks for your help.

1 Like