Updating Inputs From Server
- Define the setValue method.
- Define the receiveMessage method.
receiveMessage: function(el, data) {
console.log(data);
if (data.hasOwnProperty('value')) {
this.setValue(el, data.value);
}
// other parameters to update...
}Where:
elis the DOM element.valuerepresents the new value.dataare received from R as JS object
It is good practice to add a
data.hasOwnPropertycheck to avoid running code if the specified property does not exist.