Home > Web Front-end > JS Tutorial > body text

A brief discussion on deletion of Treegrid nodes in EasyUI_jquery

WBOY
Release: 2016-05-16 16:11:55
Original
1148 people have browsed it

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.
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!