//树
var store = new Ext.data.TreeStore({
root: {
children: [
{
text: "root",
expanded: true,
children: [{
text: "工资管理",
//展开
//expanded: true,
children: [{
text:"book",
//叶子节点
leaf:true,
// handler: function(){
// alert("adsfsdf");
// loadPage(this.text,'page/fucking.jsp');
// }
listeners:{
click:function(){
alert("adfasdf");
loadPage(this.text,'page/fucking.jsp');
}
}
},{
text:"fucking",
leaf:true
}]},{
text: "员工管理",
children:[{
text:"alegrbra",
leaf:true
}]}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});
//树的panel
var tree=new Ext.tree.Panel({
width: 150,
height:window.screen.availHeight,
store: store,
border:0,
rootVisible: false
});
当我点击节点的时候并没有事件发生,这是为什么?我这样写对吗?
------解决方案--------------------
把click事件放到外层,是treepanel的事件
- JScript code
var store = new Ext.data.TreeStore({ listeners: { click: function() { alert("adfasdf"); loadPage(this.text, 'page/fucking.jsp'); } }, root: { children: [ { text: "root", expanded: true, children: [{ text: "工资管理", //展开 //expanded: true, children: [{ text: "book", //叶子节点 leaf: true, // handler: function(){ // alert("adsfsdf"); // loadPage(this.text,'page/fucking.jsp'); // } }, { text: "fucking", leaf: true }] }, { text: "员工管理", children: [{ text: "alegrbra", leaf: true }] } ] }, { text: "buy lottery tickets", leaf: true } ] } }); //树的panel var tree = new Ext.tree.Panel({ width: 150, height: window.screen.availHeight, store: store, border: 0, rootVisible: false });
------解决方案--------------------
itemclick:{}
------解决方案--------------------
API有各种方法,没API,不然大家咋知道这些方法。