I want to detect when the Dashboard 2 user changes tabs or reloads their page. In DB1 I used the ui control node successfully to do this however in DB2 I don’t get any output from the ui-control node when changing tabs.
Can anyone suggest a way around this?
I am not using the ui control
and event
dashboard 2 nodes for page load and page get focus, since all dashboard tabs on the same window use the same socket, and event behavior is tricky.
I use a hidden template node, which invokes a 'load' event when the page is loaded, and a 'focus' event when the user switches to the tab.
<script>
export default {
mounted() {
this.send({payload:"Page 2 loaded"});
const vThis = this; // save the base context
window.addEventListener('focus', () => {
vThis.send({payload:'Page 2 received focus'});
});
}
}
</script>
There is a request to add tab change to the ui-event node, but I don't know where it is on the priority list.
Thank you for that @omrid.
Thank you @rakgupta. I had it set to “All events” but now when I check I am getting output intermittently. It seems that the tab change event is only output when there is also a connect event.
Thanks for your reply.
With the settings I have, I get the events triggered quite reliably. I use it to start the flows on each tab to pre-populate data when the user selects a particular tab/page. I do have another ui-control node that is set to “connect events only” - this is used to populate some global variables etc. that are used across all flows.
@rakgupta We have to be careful when using the word Tab. Are you talking about multiple tabs within a single page using Tab layout, or are you talking about pages? I think that unfortunately the ui-control node uses the word tab to mean pages.
I’m talking about pages…. you are right - wording is confusing.
Yes, by ‘tabs’ I am referring to the means of switching between pages of the dashboard.
Now when I use the ui control node I’m seeing output as expected for ‘connect’ and ‘change’ events as expected. Earlier I was not seeing this output and I can’t identify what has changed.
I had the same problem.
I use the UI control and no debug output was generated.
The problem was that I had to start my dashboard correctly via the correct URL /dashboard and not via a subpage.
My problem is that now, when I change something, I have to reload the dashboard via the correct URL /dashboard/ and not via a subpage, otherwise the UI control does not work correctly.
Did you see my proposed solution above?
Thanks for pointing that out @kunigunde.
I see that same issue. I need to reload the page with …/dashboard/
…/dashboard/page1. does not work.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.