jq datagrid点击编辑(进行跳转编辑的)按钮进行校验.

情况1:比如一条数据需要编辑.但是需要进行校验.校验失败,就不进行界面跳转.

 

解决方法:

field: 'opts', title: '操作', align: "center", formatter: function (val, row, index) {
var btnlist = GetButtonList(row.project_guid, row.project_type, row.project_status, row.projectStage);
var link = "<div style='min-width:100px'>";
var viewBtn = GetViewButton(GetControllerByStage(row.projectStage), "List", row.project_guid, row.projectStage);
link += "<a class='projA' href='" + viewBtn.Url + "' >" + viewBtn.Name + "</a>";
if (btnlist.length > 0) {
for (var i = 0; i < btnlist.length; i++) {
if (btnlist[i].Name == "编辑") {
link += "<a class='projA' onclick='return editcheck(\"" + row.project_guid + "\"," + row.project_status + ")' href='" + btnlist[i].Url + "' >" + btnlist[i].Name + "</a>";
} else {
link += "<a class='projA' href='" + btnlist[i].Url + "' >" + btnlist[i].Name + "</a>";
}
}
}
return link + "</div>";
}

标红部分:onclick 如果 return false 就不会进行href链接的界面跳转.

posted on 2019-08-06 09:52  只为_更加优秀!  阅读(274)  评论(0编辑  收藏  举报

导航