我需要使用模态确认删除行。如果我删除第一行 - 删除成功,但如果删除第二行和后面的行,当 showWrating(errMessage) 因为记住了名字参数。每次单击确定按钮时如何更新(设置为零)名称参数?
我的 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();
}
});
}