1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    6
    Vote Rating
    0
    echry is on a distinguished road

      0  

    Default 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);

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What's happening when you do that?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    6
    Vote Rating
    0
    echry is on a distinguished road

      0  

    Default ADDING CONTEXT MENU TO TREEPANEL

    ADDING CONTEXT MENU TO TREEPANEL


    When right-click on the mouse, the context menu does not appear.

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    6
    Vote Rating
    0
    echry is on a distinguished road

      0  

    Default


    It's ok now. I'm able to see my context menu.

  5. #5
    Sencha User
    Join Date
    Jul 2009
    Posts
    88
    Vote Rating
    1
    Ash2009 is on a distinguished road

      0  

    Default


    Quote Originally Posted by echry View Post
    It's ok now. I'm able to see my context menu.
    what changed ?

  6. #6
    Sencha User
    Join Date
    Feb 2012
    Posts
    6
    Vote Rating
    0
    echry is on a distinguished road

      0  

    Default


    NewCatHandler ,
    NewTaskHandler ,
    EditHandler
    These three functions have not yet been defined .

Thread Participants: 2

Tags for this Thread