Hybrid View

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    4
    Vote Rating
    0
    loulou is on a distinguished road

      0  

    Default Unanswered: grid - adding new menu items to individual column header

    Unanswered: grid - adding new menu items to individual column header


    I am currently adding a new menu item to a grids columnheader menu:

    var currentHeaders=grid.headerCt.getMenu();

    currentHeaders.add([{
    text: 'new option',
    menu : {
    items: [
    {
    text: 'item 1', handler: function() {
    }
    }]
    }}]);

    this adds the new option to every column header menu - I would like to target a specific column and add the new menu option to just that one - is this possible ?

  2. #2
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    All the columns use a shared menu. To achieve what you are trying to do, you'll need to override the showMenuBy function and customize the menu there.

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    4
    Vote Rating
    0
    loulou is on a distinguished road

      0  

    Default


    Ok thanks James, I will look into that

  4. #4
    Sencha Premium Member joshua.ball@osi.com's Avatar
    Join Date
    Nov 2012
    Location
    Sacramento, CA
    Posts
    43
    Answers
    1
    Vote Rating
    1
    joshua.ball@osi.com is on a distinguished road

      1  

    Default Had to rethink this one...

    Had to rethink this one...


    Just figured this out this morning. Since the menu is common to all grid columns, you'll need to add all menu items that you'll need into the menu and then show/hide them based on the activeHeader property of the menu. This will allow certain menu items to display based on the column that triggered then menu to be displayed.

    Code:
    var mainMenu = view.headerCt.getMenu();
            mainMenu.on({
                beforeshow: function(menu){
                    // If the Severity column triggered the menu, show Severity-specific menu items
                    if (menu.activeHeader.dataIndex == 'severity'){
                        for (var i=0; i<menu.items.items.length; i++){
                            if (menu.items.items[i].itemId == 'severityIndicatorMenuItem'){
                                menu.items.items[i].show();
                            }
                        }
                    // If any other column, hide Severity-specific menu items
                    } else {
                        for (var i=0; i<menu.items.items.length; i++){
                            if (menu.items.items[i].itemId == 'severityIndicatorMenuItem'){
                                menu.items.items[i].hide();
                            }
                        }
                    }
                }
            });
            
            // Add custom menu items to the default grid menu
            mainMenu.insert(mainMenu.items.length-2, [{
                itemId: 'toggleSortMenuItem',
                text: 'Toggle Sort',
                handler: function() {
                    mainMenu.activeHeader.sortable = (mainMenu.activeHeader.sortable) ? false : true;
                }
            },{
                itemId: 'severityIndicatorMenuItem',
                text: 'Severity Indicator',
                handler: function() {
                    // JB - Start here...
                }
            }]);
    Last edited by joshua.ball@osi.com; 29 Mar 2013 at 10:25 AM. Reason: Grammer error

  5. #5
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    29
    Vote Rating
    0
    loumac is on a distinguished road

      0  

    Default context menu

    context menu


    Hi Joshua, I will try your solution - I never did find the answer so thank you!

  6. #6
    Sencha Premium Member joshua.ball@osi.com's Avatar
    Join Date
    Nov 2012
    Location
    Sacramento, CA
    Posts
    43
    Answers
    1
    Vote Rating
    1
    joshua.ball@osi.com is on a distinguished road

      0  

    Default


    No prob! You should just have to switch the dataIndex and itemId properties in the example above to whatever you've got for it to work.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi