JSON Store not updating from script into HTML
-
I have an issue where I'm using the JSON store to save scheduling data. The HTML uses the <ma-json-store> function to get the data and show it. I also have a scripting data source that gets the actual SQL from the json store to modify it and sets other data source variables.
Everything works well except if the script changes the data, the HTML does not update in real-time. It requires a refresh of the page to get the changed data.
Is there any way to fix this, or perhaps have it refresh the JSON store (via a controller in app.js)? I tried to do the latter but had trouble reading the SQL/JSON data directly from the SQL via app.js, just couldn't figure out the coding... Self taught coder that no so good.
Any ideas appreciated!
-
Hi @Dan-M this is a bit of a hacky solution, but you can do this
<ma-now update-interval="5 SECONDS" output="now"></ma-now> <ma-calc input="now !== saved ? (saved = now) && !test : test" output="test"></ma-calc> <ma-json-store xid="{{test ? 'my-json-store-xid' : ''}}" item="output" value="value"></ma-json-store>
I'll add an attribute to
ma-now
so you can easily execute an expression on change for the next release. -
@Jared-Wiltshire said in JSON Store not updating from script into HTML:
="ou
Awesome, works. Just had to up the interval as my script/getSQL interval was 5 seconds and caused some conflict.