I am working on a two-state toggle switch using a static value. I want the switch state to persist even after the screen is refreshed. Currently, when I refresh the screen, the switch state resets automatically.
My goal is:
I would like to know the best approach for this ?
I am attaching the OML file for your reference.
Hello,
You can replace your variable used in the switch with a client variable .
I updated your OML.
Hi @Dinesh Murugan ,Instead of using a local variable to store the Switch state use a client variable.
Thanks
you need to store switch state either in client variable or in the database.
client variable is work for you if you are not closing the browser.
but if you want to persist the state of switch even if user close the browser that save state in database and fetch it when screen loads.
Hi ,Create a Client Variable
Hi,
As everyone suggested, use the client variables to store the state of your switch as they are stored locally, they make the app faster and smoother, even if the user navigates between screens or refreshes the page.
Attaching the OML for your reference.
Hope it helps.
Hi all ,
Really thanks for your replies.
I am working on a two-state toggle switch using a static entity with the record of IsEnable. Once the switch is changed (either true or false), I want it to remain the same for all users.
The state should persist even after a page reload
The goal is for the switch to remain true if the user sets it to true, even after a page reload. The state should be retained until the user manually changes it, and the value want to use in the app 2 as well.
Hi Dinesh,
create an entity and store the value of client variable in that entity and use that entity in your other app.
hope it helps,