Reputation: 1435
I need delete row with modal confirm. If i delete first row - delete success, but if delete second and later rows, when showWrating(errMessage) because remembered first name parameter. How I can update(set to zero) name parameter every OK button click?
My Index.cshtml:
function delRow() {
vm.onEditRow(
function (name) {
showQuestion(function (isYes) {
if (isYes)
vm.onDelRow('@Url.Action("DelScheduler")', name,
function () {
refreshGrid();
},
function (errMessage) {
showWrating(errMessage);
}
);
});
},
function () {
showWrating('@Resources.NotSelectedRow');
});
}
My TypeScript:
onEditRow(onSuccess: (name: string) => {}, onError: () => {})
{
if (this.selectScheduler() == null)
onError();
else {
onSuccess(this.selectScheduler().name);
}
}
onDelRow(url: string, name: string, onSuccess: () => {}, onError: (message: string) => {})
{
this.invokeAjax(url, { name: name }, (data) => {
if (!data.succeeded) {
onError(data.error);
} else {
onSuccess();
}
});
}
Upvotes: 0
Views: 409
Reputation: 276125
You are storing name
someplace outside the functions you have provided. One possible place where you are storing it is in this.selectScheduler().name
Use name
instead.
Upvotes: 1