Created
December 23, 2016 14:20
-
-
Save YeomanYe/37f6f658a3e90d566c5ebd59027352fd to your computer and use it in GitHub Desktop.
EasyUI:removeConfirm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 移除确认对话框 | |
* @param {object/string} arg 用于设置的参数或url字符串 | |
* @param {function} callback 回调函数 | |
*/ | |
function removeConfirm(arg,callback){ | |
var option = { | |
//datagrid的Id | |
datagridId: arg.datagridId ? arg.datagridId : "datagrid", | |
//url | |
url: arg.url ? arg.url : url, | |
//callback | |
callback: arg.callback ? arg.callback : callback, | |
}; | |
var rows = $("#"+option.datagridId).datagrid("getSelected"); | |
if (rows) { | |
$.messager.confirm("提示!","是否要删除所选信息?",function(r){ | |
ids = $("#"+option.datagridId).datagrid("getChecked"); | |
var idString =""; | |
for (var int = 0; int < ids.length; int++) { | |
idString += ids[int].id + "$"; | |
} | |
$.ajax({ | |
type: "GET", | |
url:option.url + idString, | |
beforeSend:function(){ | |
$.messager.progress({text:"正在删除中..."}); | |
}, | |
success:function(data){ | |
$.messager.progress('close'); | |
$.messager.alert("提示!","删除成功!","info",function(){ | |
$('#'+option.datagridId).datagrid('reload'); | |
}); | |
if(typeof option.callback === "function"){ | |
option.callback(); | |
} | |
} | |
}); | |
}); | |
}else{ | |
$.messager.alert("提示!","请选择需要删除的信息!","warning"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment