Posts: 1
Threads: 1
Joined: Feb 2019
Reputation:
0
Hi,
I have made some changes to the database that we are using. With the database changes made
using lua scripts the results don't appear in the Objects Web page until I perform a Browser
refresh (F5). Even after this the objects don't reflect their live status until the hardware
is rebooted. I realise this is 2 issues but am hoping to deal with them both using the lua
scripting. Can anyone please suggest what I need to do here. It's not SQL based rather refreshing
the GUI and re-loading the database. Are there finctions in a library somewhere perhaps?
I hope this isn't a silly question and thank you to anyone who can spare the time.
Stevo
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
I have a custom JS that you can use to refresh the browser by a knx object (write to this object from LUA script), after adding that you need to refresh the browser once to load it.
I will post it later today.
For the database issue you are facing we need some info what you are doing as a browser refresh should and does always result in a actual object state, never seen other values then actual db values.
I think you do something strange that causes that..
BR,
Erwin
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Check if browser error console (opens by pressing F12) has any errors.
Posts: 136
Threads: 20
Joined: Jul 2015
Reputation:
0
Hi,
thanks Erwin
This is the code I use and sometimes reloading from the server is not done even with "location.reload(true)"
BR
Jean-Marc.
Jean-Marc
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
Have you checked with console that the function is called?
Also in this sample is at the end of the grp.listen a extra parameter ‘true’, this makes the action executed by the same object value, if it is not in your version you might send only true and then it won’t be triggered, so try this version first as i never heared it doesn’t work.
BR,
Erwin
Posts: 136
Threads: 20
Joined: Jul 2015
Reputation:
0
Hi,
I didn’t say that it doesn’t work, I said that sometimes "location.reload(true)" is done on the cache and not on the server.
I did some research on it but I couldn’t find anything.
Br
Jean-Marc.
Jean-Marc
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
02.03.2019, 14:24
(This post was last modified: 02.03.2019, 14:25 by Erwin van der Zwart.)
Hi,
Custom JS is never executed on the server side, it’s just a piece of JS that is injected into the HTML that is loaded by the client(s) and executed by the browser. So it runs always client side.
Once loaded by the browser it should always execute and cache has nothing to do with that, check the HTML source code if it’s inserted correctly, then it should work every time it’s triggered.
Only reason that might not trigger it after being loaded is a interupted websocket but that would also stop all other object updates.
BR,
Erwin
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
03.03.2019, 08:23
(This post was last modified: 03.03.2019, 08:25 by Erwin van der Zwart.)
Hi,
Aah, Okay, the difference in the ‘true’ parameter is that the browser loads the page default from cache and not everything from the server, so it will use images and other source files like css from the cache to avoid unneeded load.
In both cases the function should always be triggered, when you have added for example new images with the exact same name or other updated files with exact same names it will not be replaced by a reload as the browser asumes the files it already has are latest. In that case you need to add the parameter true to force the browser to download all files anyhow.
In either scenario the browser should reload and you should notice a blink of the refresh, thats why i say to use the console to check it.
BR,
Erwin