extjs 4 tree 事件 的单击节点时间怎么添加??
展开全部
treePanel.on({
//目录树单击事件
'itemclick' : function(view, rcd, item, idx, event, eOpts) {
var dirid = rcd.get('id'); //节点id
var dirtype = rcd.raw.dirtype; //自定义数据
},
//目录树双击击事件
'itemdblclick' : function(view, rcd, item, idx, event, eOpts) {
var dirid = rcd.get('id'); //节点id
var dirtype = rcd.raw.dirtype; //自定义数据
},
//目录数右键事件
'itemcontextmenu' : function(view, rcd, item, idx, event, eOpts) {
event.preventDefault();
this.showTreeItemMenu(rcd, event); //自定义处理函数
},
scope : this
});
!!多查查extjs的api,对每个属性\方法\事件都有详细解释
//目录树单击事件
'itemclick' : function(view, rcd, item, idx, event, eOpts) {
var dirid = rcd.get('id'); //节点id
var dirtype = rcd.raw.dirtype; //自定义数据
},
//目录树双击击事件
'itemdblclick' : function(view, rcd, item, idx, event, eOpts) {
var dirid = rcd.get('id'); //节点id
var dirtype = rcd.raw.dirtype; //自定义数据
},
//目录数右键事件
'itemcontextmenu' : function(view, rcd, item, idx, event, eOpts) {
event.preventDefault();
this.showTreeItemMenu(rcd, event); //自定义处理函数
},
scope : this
});
!!多查查extjs的api,对每个属性\方法\事件都有详细解释
展开全部
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});
var tree = Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody()
});
tree.on({
'itemclick' : function(thisTree, record, item, index, e, options) {
// thisTree自己本身
//record 点击选中的记录,rcd.get('id'); //节点id
},
})
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "alegrbra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});
var tree = Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody()
});
tree.on({
'itemclick' : function(thisTree, record, item, index, e, options) {
// thisTree自己本身
//record 点击选中的记录,rcd.get('id'); //节点id
},
})
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询