I have a JQGrid with a select column. I'd like to require the user to "confirm" the change before it's committed to the database.
I can intercept the cell change and prevent the data from being submitted to the server, but by the time the event fires, the UI is already changed.
Is there a way to either catch a "before changed" event, or to revert the select element's value to whatever it was before the user changed it?
Here is how I'm currently catching the changed event
{
name: 'ApplicationStatus', index: 'ApplicationStatus', width: 110, align: "left", sortable: true, editable: true, edittype: "select",
editoptions: {
value: StatusList,
defaultValue: this.value,
dataEvents: [
{
type: 'change',
fn: function (e)
{
if (!confirm("Are you sure wish to change the Status?")){
// HOW DO REVERT VALUE OF SELECT BOX HERE?
return;
}
$('.jqu-garid').block({ message: null });
$.post("ApplicationStatusChangeto/", { NewStatus: this.value, ApplicationId: lastSelection }, function (data)
{
if (data.success)
{
$('.jqu-garid').unblock();
$("#list47").trigger("reloadGrid");
}
else
{
}
});
}
}]
}, searchoptions: { sopt: ['cn'] }
}
Aucun commentaire:
Enregistrer un commentaire