Forum /
Ext JS Community Forums 3.x /
Ext 3.x: Help & Discussion /
ADDING CONTEXT MENU TO TREEPANEL
ADDING CONTEXT MENU TO TREEPANEL
Dear All,
Is there anybody to help me?
I have this which allow me to create a TreePanel and load data coming from database.
I want to add a contextmenu that has these three actions (New Category, New Task, Edit ).
Ext.onReady(function () {
var Tree = Ext.tree;
tree = new Tree.TreePanel({
el: 'divEmployees',
useArrows: true,
animate: true,
enableDD: true,
containerScroll: true,
frame: true,
height: 900,
dataUrl: 'TreeLoader.aspx',
root: {
nodeType: 'async',
text: 'Categories/Tasks',
visible: false,
id: 'source'
}
});
// render the tree and expand the parent node
tree.render();
tree.getRootNode().expand();
});
I tried with those two functions below but it does not work.
//Creation of my contextmenu
var contextMenu = new Ext.menu.Menu({
items: [
{ text: 'New Category', handler: NewCatHandler },
{ text: 'New Task', handler: NewTaskHandler },
{ text: 'Edit', handler: EditHandler }
]
});
function treeContextHandler(node) {
node.select();
contextMenu.show(node.ui.getAnchor());
}
tree.on('contextMenu', treeContextHandler);
Sencha - Senior Forum Manager
What's happening when you do that?
ADDING CONTEXT MENU TO TREEPANEL
ADDING CONTEXT MENU TO TREEPANEL
When right-click on the mouse, the context menu does not appear.
It's ok now. I'm able to see my context menu.
Originally Posted by
echry
It's ok now. I'm able to see my context menu.
what changed ?
NewCatHandler ,
NewTaskHandler ,
EditHandler
These three functions have not yet been defined .
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us