Home > php教程 > PHP开发 > A brief discussion on deletion of Treegrid nodes in EasyUI

A brief discussion on deletion of Treegrid nodes in EasyUI

高洛峰
Release: 2016-12-29 13:51:40
Original
1149 people have browsed it

Deleting in EasyUI is very simple, usually just copy and paste.

The following is the deletion of tree nodes.

// 删除
function removes() {
    var rows = ruletreegrid.treegrid('getSelections');
    if (rows && rows.length == 1) {
        var showmsg = "";
        if (rows[0].pid == 0) {
            // 下面有子节点
            showmsg = "项目下面可能存在细则,是否也一起删除 ?";
        } else {
            showmsg = "是否删除此细则 ?";
        }
        parent.$.messager.confirm('提示', showmsg, function(r) {
            if (r) {
                $.ajax({
                    url : "assess/rule/ruleremoves/" + rows[0].id + ".do",
                    dataType : "json",
                    success : function(data) {
                        if (data && data.success) {
                            if (data.msg && data.msg != "")
                                parent.$.messager.alert('提示', data.msg);
                            else
                                parent.$.messager.alert('提示', "删除成功");
                            ruletreegrid.treegrid('remove', rows[0].id);
                            ruletreegrid.treegrid('reload', rows[0].pid);
                        } else {
                            parent.$.messager.alert('错误', data.msg);
                        }
                    }
                });
            }
        });
    } else {
        parent.$.messager.alert('提示', "请选择一条要删除的项目!");
    }
}
Copy after login

The above is the entire content of this article, I hope you all like it.

For more articles related to the deletion of Treegrid nodes in EasyUI, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template