
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 09:03 PM
Hi,
I need to Refresh a widget/ clearing widget data when another variable in form changes. did anyone faced the same situation??
Thanks,
Satheesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 09:31 PM
Hi,
1) You can use $sp.page.g_form to get variable values in widget
2) You need to use $watch controller method to keep an eye of variable change ( this is like event in DOM, when variable changes, $watch senses it )
3) Once you get this event fired for variable in step 1, you can reset the data variable object in client controller script.
Please see below link $watch usage to check how you can use $watch to keep a track of variable value change.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 09:04 PM
Can you elaborate more or provide screenshots?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 09:31 PM
Hi,
1) You can use $sp.page.g_form to get variable values in widget
2) You need to use $watch controller method to keep an eye of variable change ( this is like event in DOM, when variable changes, $watch senses it )
3) Once you get this event fired for variable in step 1, you can reset the data variable object in client controller script.
Please see below link $watch usage to check how you can use $watch to keep a track of variable value change.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 11:32 PM
Hello Satheesh,
In HTML part of widget add onchange event on the field to call a function in client controller. In this function you can add logic tp refresh the data (hope its data object). If you need to update the data objects with new values based on the variable changed, use one of the following methods .
this.server.get() : Calls the Server Script and passes custom input.
this.server.update() : Calls the server and posts this.data to the Server Script.
this.server.refresh() : Calls the server and automatically replaces the current options and data from the server response.
you can user input/data object to send changed variable to server script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 01:17 AM
Could you please mark response as correct and close the thread?