Hello,
I have Master/Detail page layout where on the left side of the page there is Kendo Grid with the list of items and on the right side of the page there is specific item details.
I want to prompt confirmation message to the user if changes were done in the detail section and user clicked on the different item in the list of items grid prior to saving changes.
Initially, I though I should be able to catch "click" event and based on the prompt popup result either do nothing or apply
e.stopPropagation();
e.preventDefault();
e.stopImmediatePropagation();
Apparently it is not working with click event in the Kendo Grid as selection within the grid changes prior to firing "click" event. I guess I just do not know where to hook my click event.
So then I decided to hook up to the mousedown event, which help me prevent row selection prior to closing prompt popup, but it looks like event chain breaks and no normal "click"-related processing happens. Row stays unselected and no change event fires.
Did I miss something? Can you suggest best way to achieve required functionality (prompt user prior to selecting row different from the one currently selected)?
Thank you,
Andrei
I have Master/Detail page layout where on the left side of the page there is Kendo Grid with the list of items and on the right side of the page there is specific item details.
I want to prompt confirmation message to the user if changes were done in the detail section and user clicked on the different item in the list of items grid prior to saving changes.
Initially, I though I should be able to catch "click" event and based on the prompt popup result either do nothing or apply
e.stopPropagation();
e.preventDefault();
e.stopImmediatePropagation();
function selectionValidation() {
// Place your validation logic here
return confirm("Change selection");
}
onGridDataBound: function () {
// Intercept click event to prevent row from loosing focus
// if user decide not to loose changes done in the detail section
this.grid.tbody.find("tr[class='templated-row ']").click(this.checkDataChanged);
},
checkDataChanged: function (e) {
newValues = $('form').serialize();
if (initialValues !== newValues) {
if (selectionValidation()) {
} else {
e.stopPropagation();
e.preventDefault();
e.stopImmediatePropagation();
}
}
},
Apparently it is not working with click event in the Kendo Grid as selection within the grid changes prior to firing "click" event. I guess I just do not know where to hook my click event.
So then I decided to hook up to the mousedown event, which help me prevent row selection prior to closing prompt popup, but it looks like event chain breaks and no normal "click"-related processing happens. Row stays unselected and no change event fires.
Did I miss something? Can you suggest best way to achieve required functionality (prompt user prior to selecting row different from the one currently selected)?
Thank you,
Andrei