fires when a user changes month, year or time in selector
date | array | an array with the Date object of the selected date |
config | any | the source of change |
const format = webix.Date.dateToStr("%d.%m.%Y");
$$("calendar").attachEvent("onChange", function(date, config){
webix.message(`Selected date is ${format(date[0])}. 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:"calendar",
// ..config
on:{
onChange: function(date, config){
// config is {yourProperty: "yourValue"}
}
}
});
// onChange event will receive object as the 3rd parameter
$$("$calendar1").setValue(newValue, {yourProperty: "yourValue"});