Search...
onPropsChanged( )
Adds an event handler that runs when the value of a widget property is changed.
Description
A widget receives an onPropsChanged
event when one or more of its properties is changed via its API.
Syntax
function onPropsChanged(handler: onPropsChangedHandler): anyhandler: function onPropsChangedHandler(oldProps: Object, newProps: Object): void
onPropsChanged Parameters
NAME
TYPE
DESCRIPTION
handler
The name of the function or the function expression to run when the value of a widget property is changed.
Returns
Return Type:
any
onPropsChangedHandler Parameters
NAME
TYPE
DESCRIPTION
oldProps
Object
The old widget properties.
newProps
Object
The new widget properties.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
Load updated data when a widget's property is changed
Copy Code
1$widget.onPropsChanged((oldProps, newProps) => {2 loadProductData(newProps.productId);3 loadCustomerData(newProps.customerId);4});