I use element type=“multiselect” (with suggest “checksuggest”) into view property. When I press key Esc (to cancel edit and not save change), the popup is hiding, but event “onAfterEditStop” is not called. Then I click on any place (eg other property element), event triggered with params old and new values (of element multiselect) and ignoreUpdate=undefined. And then new value is applyed.
How to undo user selected values?
I am trying to handle the onKeyPress event and call the editCancel() method of the view “property”. This does not work.
My example:
{
view: 'property',
id: 'cell_props',
complexData: true,
elements: [
{
label: 'Date from',
type: 'date',
id: 'opt.dateFrom',
value: '',
format: webix.Date.dateToStr('%d.%m.%Y'),
suggest: {
type: 'calendar',
body: {
icons: true,
on: {
onDateClear: function() {this.hide();}
}
}
}
},
{
label: 'Date to',
type: 'date',
id: 'opt.dateTo',
format: webix.Date.dateToStr('%d.%m.%Y'),
suggest: {
type: 'calendar',
body: {
icons: true,
on: {
onDateClear: function() {this.hide();}
}
}
}
},
{
label: 'Regions',
type: 'multiselect',
options: [{id:'01', value: 'Region 01'},
{id:'02', value: 'Region 02'},
{id:'03', value: 'Region 03'},
{id:'04', value: 'Region 04'},
{id:'05', value: 'Region 05'},
{id:'06', value: 'Region 06'},
{id:'07', value: 'Region 07'},
{id:'08', value: 'Region 08'},
{id:'09', value: 'Region 09'},
{id:'10', value: 'Region 10'}
],
id: 'opt.regions',
width: 300,
suggest: {
view: 'checksuggest',
selectAll: true,
button: true,
body: {
template: '#id# - #value#',
yCount: 15
}
}
}
],
on:{
onBeforeEditStart: function(id){
return true;
},
onAfterEditStop(state, editor, ignoreUpdate) {
console.log(ignoreUpdate);
console.log(state);
if (state.value.valueOf()!=state.old.valueOf()) {
console.log('save');
}
}
}
}