Page 1 of 1

Screen Refresh after Local Storage Value Change

Posted: 15 Nov 2022, 16:26
by dylan.ramirez
Good Day Everyone.
I had some issue regarding a local storage value. Is that possible to refresh the aXes screen without loading the whole page every time the local storage value is changed?

As you see the attached picture, I want to automatically change the value of the date field at the left side of the screen depends on the selected date from date field at the right side of the screen.

Re: Screen Refresh after Local Storage Value Change

Posted: 16 Nov 2022, 11:42
by dylan.ramirez
Hi folks,
I already got the solutions by using the FIELDS() event and the refresh function.

windows.onStorage{
const variable = FIELDS("fieldname");
variable.refresh();
}

Re: Screen Refresh after Local Storage Value Change

Posted: 08 Dec 2022, 10:00
by tim mcentee
Hi Dylan

A few things.
1) using const is not correct. a field object is a changeable object - ie .refresh() - so you should use variable assignment let rather than const.
2) listening to the global windows.onStorage event means that the field will be refreshed when the screen is active and some activity happens to windows storage.

3) You can access the field directly from the datepicker. In the datepicker event onSelectValueChanged

/* datepicker value */
let txtFromDate = FIELD.getValue();
/* aXes 5250 field object */
let fldFromDate = FIELDS("txtFromDate");
/* set aXes field with datepicker value */
fldFromDate.setValue(txtFromDate);