Extjs4.x Ext.tree.Panel 遍历当前节点下的所有子节点

Ext.define('WMS.controller.Org', {
    extend: 'Ext.app.Controller',
    stores: ['OrgUser', 'OrgTree'],
    models: ['OrgUser'],
    views: ['OrgTb', 'OrgTree', 'OrgUserGrid'],
    refs: [
        {
            ref: 'orgTree',
            selector: 'orgTree'
        },
        {
            ref: 'OrgUserGrid',
            selector: 'OrgUserGrid'
        }
    ],
    init: function () {
        this.control({
            'OrgTree': {
                itemclick: function (view, record, item, index) {
                    var id = record.getId();
                    var Enode = view.getTreeStore().getNodeById(id);
                    var idArray = new Array();//遍历树,放到array里
                    idArray.push(id);
                    if (id != "0")
                        this.GetChilds(idArray, Enode);
                    usrstore = this.getOrgUserStore();
                    usrstore.getProxy().setExtraParam("ids", idArray);
                    usrstore.load();
                }

        });
    },
//递归 GetChilds: function (idArray,node) { ts
= this; childnodes = node.childNodes; Ext.each(childnodes,function () { var nd = this; idArray.push(nd.getId()); if (nd.hasChildNodes()) { ts.GetChilds(idArray, nd); } }); } });
原文地址:https://www.cnblogs.com/qidian10/p/3142514.html