1

控制器中的代码

nextPages:function()
{  
var obj=Ext.getCmp('centerId');

obj.removeAll();//remove center panel to display new panel information
var myTree=Ext.getCmp('leftId');//get tree panel view
var node=myTree.getRootNode().findChild("navTree","localId",true);//for get child node
if(node){

var obj2=Ext.create('AS.view.center.Localadmin');
obj2.region='center';
obj.add(obj2);
}

视图中的代码:

Ext.define('AS.view.left.Left',{
    extend:'Ext.tree.Panel',
    alias:'widget.Left',
    id:'leftId',
    useArrows   : true,
    hideHeaders : true,
    //title: 'About village',

    height: 150,
    root: {
        itemId:'navTree',
        rootVisible : false, 
        text:'About village',
        children:[{
        text:'Whats nearby?', 
        expanded: true,
        children: [{
           // id:'first',

            id:'localId',
            text: 'Local Administration',

            leaf: true
        }, {
            id:'bId',
             text: 'Bussiness directory',

            leaf: true
        },{
            id:'hid',
         text: 'Heritage and tourism',

         leaf: true
        },{
            id:'eid',
         text: 'Education',

         leaf: true
        }],
        },

        {
            text:'classifieds',
             leaf: true
        },{
            text:'Events',
             leaf: true


        }],//children1
    },//root



});

我想获取单击事件的特定子节点,然后在该节点的单击上显示另一个面板。告诉我如何从树形面板中获取子节点。在控制器中,我编写了一个函数来获取子节点,然后在单击特定节点时获取视图。

4

0 回答 0