In Data table: I have a scenario where validation has to be performed, if the mandatory cells of the selected row are empty and user clicks enter to save the record/update. Then a pop-up has to appear asking whether save the changes or discard the changes.
If user selects “save the changes” then user can go ahead for other rows. But when clicks on “Discard changes” then need to keep focus on the empty cell.
But here I have to do validation only on the particular column of the data table like “Title” should never be empty.
And the confirm window has to come on the press of enter button after reaching the last cell of the selected row.
Do you mean row editing when multiple editors are opened for a row?
During row editing, the onBeforeEditStop event fires for each cell in a row consquently, so to avoid repetitive calls you need to show the confirm window only for the last column’s editor: https://webix.com/snippet/f4716ce2
But does it make sense to close editors if another cell is focused? The empty value will be saved, and such behaviour is not desired.
I have some small issue like "I make the mandatory field as empty and click Ok in the confirm window. If i click on the same cell, again the confirm window is getting triggered. "
if(editor.column == "title" && !values.value){
//debugger;
webix.confirm({
text:"The value is empty. Do you want to save it anyway?",
callback:webix.bind(function(res){
this.blockEvent();
if(res)
this.editStop();
else
editor.focus();
this.unblockEvent();
}, this)
});
return false;
}
}
if(editor.column == "title" && !values.value){
//debugger;
webix.confirm({
text:"The value is empty. Do you want to save it anyway?",
callback:webix.bind(function(res){
this.blockEvent();
if(res)
this.editStop();
else
editor.focus();
this.unblockEvent();
}, this)
});
return false;
}
}
How to have a single confirm message when all the mandatory fields of the data table are empty. And focus to the first mandatory cell of the data table.