Logic Machine Forum
Change default page dinamically - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Change default page dinamically (/showthread.php?tid=574)



Change default page dinamically - Mirco - 24.01.2017

Hi,
I have 2 pages, the first for displaying some datas and the second for displaying important error.
Now what I would to do is:
- when there are no errors, users can only see the first page.
- when there are errors, users can only see the second page until the errors are returned to 0.
- if a users open the page after errors occurred, he must see only the second page.
- if errors occured when a user have open the first page, he must be redirected to the second page.

PS: all errors are 1 bit objects (0 = no error, 1 = error)

Is there a way to do that?

Hope that you understand what I mean, otherwise I will try to explain better! Wink 

Thanks!


RE: Change default page dinamically - admin - 24.01.2017

You can create a status object which error count and then use grp.listen and showPlan functions in custom JavaScript to check the error state. grp.listen callback is executed when object values are loaded and after each value change.


RE: Change default page dinamically - admin - 24.01.2017

Have a look at this post:
http://forum.logicmachine.net/showthread.php?tid=275&pid=2815#pid2815


RE: Change default page dinamically - Mirco - 24.01.2017

Is there a way to change the default page when the value of an object change?
The javascript code in the thread you linked works only when you have the visualization open. It doesn't work if you enter in the visualization after that the object changed value.


RE: Change default page dinamically - admin - 24.01.2017

Just remove if (state == 'value') { check and it will trigger when user opens the visualization.


RE: Change default page dinamically - Mirco - 24.01.2017

It works! Thank you again! Big Grin