I have a dashboard I'm developing that I've configured like so in the dashboard.config:
Just a typical Umbraco 7 AngularJS dashboard (the controller is loaded using a package.manifest in the App_Plugins folder). My question relates to this tab:
Is there a nice way in my JavaScript controller to detect when "My New Tab" is activated?
Basically, I have to hit an API controller with a computationally expensive operation, and I'd like to avoid doing that unless users actually view the tab. My current workaround is to just hit the API controller when a button is clicked by the user.
My thought is that there must be some event that Umbraco emits whenever a tab is activated.
Detecting Activation of Tab for Custom Dashboard
I have a dashboard I'm developing that I've configured like so in the dashboard.config:
Just a typical Umbraco 7 AngularJS dashboard (the controller is loaded using a package.manifest in the App_Plugins folder). My question relates to this tab:
Is there a nice way in my JavaScript controller to detect when "My New Tab" is activated?
Basically, I have to hit an API controller with a computationally expensive operation, and I'd like to avoid doing that unless users actually view the tab. My current workaround is to just hit the API controller when a button is clicked by the user.
My thought is that there must be some event that Umbraco emits whenever a tab is activated.
Hello,
I'm currently unaware of such a feature. What you could try and do is inject some custom js and add an onclick on the tab for example. Have a look at this package to inject custom js: https://our.umbraco.org/projects/collaboration/backoffice-tweaking
Jeroen
Hi Jeroen,
Thanks for the tip. I can probably refer to the source code for that project to figure out how to target tabs, though I already have the technique I'd need to inject custom JS: https://our.umbraco.org/forum/developers/extending-umbraco/63379-Custom-CSSJavaScript-for-Umbraco-Backoffice
For now, I think I'll just stick with the button unless somebody else can chime in with an event that Umbraco emits whenever a tab is switched.
Hi Nicholas.
I use the following script to handle TAB clicks in my custom section
In your HTML, add an ID to the elemnt containing your "controller" attribute for angular Etc.
Then add this Jquery to your html
Hope it helps. Jonas
is working on a reply...