fires when the value of the control is changed
newValue | any | newly set value |
oldValue | any | previous value |
config | any | source of change |
$$("control").attachEvent("onChange", function(newValue, oldValue, config){
webix.message(
`Value changed from ${oldValue} to ${newValue}. Source: ${config}`
);
});
The config parameter can have the following values:
Also, you can get a custom value as the config parameter. To do that call the setValue/setValues method passing your value as the last argument:
webix.ui({
view:"toggle",
// ..config
on:{
onChange: function(newValue, oldValue, config){
// config is {yourProperty: "yourValue"}
}
}
});
// onChange event will receive object as the 3rd parameter
$$("$toggle1").setValue(newValue, {yourProperty: "yourValue"});