首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Extjs 触发事件有关问题

2012-03-19 
Extjs触发事件问题//树var store new Ext.data.TreeStore({root: {children: [{text: root,expanded:

Extjs 触发事件问题
//树
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 }  ]    }});//树的panelvar tree = new Ext.tree.Panel({    width: 150,    height: window.screen.availHeight,    store: store,    border: 0,    rootVisible: false});
[解决办法]
itemclick:{}
[解决办法]
API有各种方法,没API,不然大家咋知道这些方法。

热点排行