easyui tree 편집 후 원래 상태 유지

2527 단어 easyui

 
    
    $(function () {
        var selected = $('#depttree').tree('getSelected');
        $('#depttree').tree({
            checkbox: false,
            animate: true,
            url: '/Provider/HandlerCommon.ashx?method=getdepttree&parentid=<%=deptid%>',
            onClick: function (node) {
                //  $(this).tree('toggle', node.target);
                // $("#url3").attr("src", "PersonMain.aspx?deptid="+node.id)
                //    $('#treeuserinf').datagrid({ url: '/Provider/HandlerPerson.ashx', queryParams: { 'deptid': node.id} });
                //  var selected = $('#Admin_List').datagrid('getSelected');
                $('#Admin_List').datagrid({ url: '/Provider/HandlerPersonList.ashx?method=list', queryParams: { 'deptid': node.id} });
                // alert(node.id);


            }, onSelect: function (node) {
                deptid = node.id;
            },
            onExpand: function (node) {
                expandid = node.id;
            },
            onLoadSuccess: function (row, data) {
                var roots = $('#depttree').tree('getRoots');
                var childs = $('#depttree').tree('getChildren', roots[0].target); //alert(childs.length);

                for (j = 0; j < childs.length; j++) {

                    $('#depttree').tree('collapse', childs[j].target);

                }
                if (deptid == roots[0].id) {
                    $('#depttree').tree('select', roots[0].target);
                    $('#depttree').tree('expand', roots[0].target);
                }

                for (j = 0; j < childs.length; j++) {
                    if (deptid == childs[j].id) {
                        $('#depttree').tree('select', childs[j].target);
                     
                    }
                    if (expandid == childs[j].id) { 
                         $('#depttree').tree('expand', childs[j].target);
                    }
                }



            }
        });
    });

좋은 웹페이지 즐겨찾기