[英]Delete with modal confirm
我需要刪除帶有模式確認的行。 如果我刪除第一行-刪除成功,但是如果刪除第二行和以后的行,則在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();
}
});
}
您正在將name
存儲在提供的功能之外的某個位置。 一個可能的存儲位置在this.selectScheduler().name
改用name
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.