1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    studymania is on a distinguished road

      0  

    Default handling itemcontextmenu event for specific column in Ext.tree.Panel..

    handling itemcontextmenu event for specific column in Ext.tree.Panel..


    i am using Ext.tree.panel as on right click in first column i want to display itemcontextmenu 1 and on right click on in second column i want to display itemcontextmenu 2 so basically i want display different item context menu based on right click in different column in ext.tree.panel. can you please advice how can i achieve that?

    untitled.JPG
    Last edited by studymania; 27 Jun 2012 at 4:21 PM. Reason: added image..

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    studymania is on a distinguished road

      0  

    Default


    any help would greatly appreciated.

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,081
    Vote Rating
    467
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Have you have a look on the params after you click the menu

    Code:
    listeners: {
        itemcontextmenu: function(view, node, htmlItem, index, e, eOpts ) {
            e.stopEvent();
            var treeMenu = Ext.create('Ext.menu.Menu',{
                items: [
                {
                    text: 'Click me',
                    handler: function() {
                        console.log(e);
                    }
                }
                ]
            });
            treeMenu.showAt(e.xy);
        }
    }
    Scott.

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    studymania is on a distinguished road

      0  

    Default


    thanks much for reply Scott.

    what is want is when we user right click in first column of the grid panel i want to display menu for add operation and when user click on second column i want to display menu for history operation.

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    studymania is on a distinguished road

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    Have you have a look on the params after you click the menu

    Code:
    listeners: {
        itemcontextmenu: function(view, node, htmlItem, index, e, eOpts ) {
            e.stopEvent();
            var treeMenu = Ext.create('Ext.menu.Menu',{
                items: [
                {
                    text: 'Click me',
                    handler: function() {
                        console.log(e);
                    }
                }
                ]
            });
            treeMenu.showAt(e.xy);
        }
    }
    Scott.
    yes i looked at the params but do not find any information related to which column being clicked. i only found row id.

  6. #6
    Sencha User
    Join Date
    May 2013
    Posts
    3
    Vote Rating
    0
    Manmohan is on a distinguished road

      0  

    Default FireEvent not get HTMLTarget, i, e

    FireEvent not get HTMLTarget, i, e


    Hi,

    I my code i try to call FilterPanel.fireEvent('itemcontextmenu');



    var FilterPanel = Ext.create('Ext.tree.Panel', {
    store: filterStore,
    id : 'resultFilterPanel',
    rootVisible: false,
    useArrows: false,
    frame: false,
    renderTo: 'tree-div',
    height : 500,
    width : 500,
    border:false,
    flex: 1,
    bodyBorder :false,
    autoScroll:false,
    listeners: {
    itemcontextmenu: function(view, record, HTMLTarget, i, e) {
    alert("rr-->"+record);alert("HTMLTarget-->"+item);alert("i-->"+i);alert(e);
    //HTMLTarget, i, e values are undefined.
    FilterPanel.menu.record = record;
    FilterPanel.menu.HTMLTarget = HTMLTarget;
    FilterPanel.menu.showAt(e.getXY());
    e.preventDefault();
    }
    }
    });


    HTMLTarget, i, e values are undefined.
    What is wrong in my code, how can i get value all these.

    I want menu on eventCall() function call.
    eventCall=function(){

    FilterPanel.fireEvent('itemcontextmenu');

    }

    When i try rightclick on node it's work fine.

    Thanks a lot.

Thread Participants: 2