日期:2014-05-16  浏览次数:20433 次

Extjs4 怎么给树添加点击事件

Ext.require([
    'Ext.tree.*',
    'Ext.data.*'
]);
Ext.define('etb.tree.MainPanelTree',{
extend:'Ext.tree.Panel',
    border:false,
    width: 200,
    height: 150,
    store:Ext.create('Ext.data.TreeStore', {
    root: {
        expanded: true, 
        text:"",
        user:"",
        status:"", 
        children: [
            { text:"detention", leaf: true},
            { text:"homework", expanded: true, 
                children: [
                    { text:"子节点1", leaf: true },
                    { text:"子节点2", leaf: true}
                ]
            },
            { text: "buy lottery tickets", leaf:true }
        ]
    }
    
}),
    rootVisible: true     
});
 


想给子“节点1”添加一个单击事件怎么做,好像Extjs4 没有TreeNode这个对象

------解决方案--------------------
Ext.require([
    'Ext.tree.*',
    'Ext.data.*'
]);
    Ext.define('etb.tree.MainPanelTree',{
        extend:'Ext.tree.Panel',
                border:false,
                width: 200,
                height: 150,
                store:Ext.create('Ext.data.TreeStore',