Home >Web Front-end >JS Tutorial >A brief discussion on deletion of Treegrid nodes in EasyUI_jquery

A brief discussion on deletion of Treegrid nodes in EasyUI_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:11:551209browse

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

The following is the deletion of tree nodes.

Copy code The code is as follows:

// Delete
function removes() {
var rows = ruletreegrid.treegrid('getSelections');
If (rows && rows.length == 1) {
        var showmsg = "";
If (rows[0].pid == 0) {
// There are child nodes below
                 showmsg = "There may be details under the project, do you want to delete them too?";
         } else {
showmsg = "Delete this rule?";
}
          parent.$.messager.confirm('prompt', 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('prompt', data.msg);
                                                                                                 else parent.$.messager.alert('prompt', "Delete successfully");
ruletreegrid.treegrid('remove', rows[0].id);
ruletreegrid.treegrid('reload', rows[0].pid);
                            } else {
Parent.$.messager.alert('Error', data.msg);
                                                                                                       }                  }
                });
            }
        });
} else {
​​​​ parent.$.messager.alert('Prompt', "Please select an item to delete!");
}
}


The above is the entire content of this article, I hope you all like it.
Statement:
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