Extjs 右击菜单效果图
ExtJs Tree显示
var zzjgTreePanel = Ext.createWidget('treepanel', {
store : treestore,
id : 'zzjgtree',
rootVisible : false,
useArrows : true,
hideHeaders : true,
border : false,
columns : [{
header : '流水号',
dataIndex : 'id',
hidden : true
}, {
dataIndex : 'text',
xtype : 'treecolumn',
flex : 1
}],
viewConfig : {
stripeRows : true
},
anchor : '100% 100%',
autoScroll : true,
listeners : {
itemclick : function(view, record, item, index, e) {
//单击事件
},
itemcontextmenu: function(menutree, record, item, index, e) {
//右击事件
//alert('123');
e.preventDefault();
e.stopEvent();
//this.getSelectionModel().select(record);
rightClick.showAt(e.getXY());
}
}
});
ExtJs 右键菜单
var rightClick = new Ext.menu.Menu({
items : [{
text : '新建顶级机构',
iconCls : 'settingCategory',
scope : this,
handler : addDjjg
}, '-', {
text : '编辑当前机构',
iconCls : 'settingCategory',
scope : this,
handler : updatezzjg
}, '-', {
text : '删除当前机构', // todo
iconCls : 'settingCategory',
scope : this,
handler : deletejg
}, '-', {
text : '新建子机构',
iconCls : 'settingCategory',
scope : this,
handler : addZjg
}]
});
Ok!