1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
    yurec45 is on a distinguished road

      0  

    Default Alternative to hmenu in extJS 4

    Alternative to hmenu in extJS 4


    hmenu does not work in extJS 4

    Hi,
    I am relatively new to extJS and converting project from 3.2 to 4.0 and run into code where I need to add item to grid header. Originally it was done using hmenu, however, it does not work in 4.0. and I could not find any equivalent to it or any solution.

    3.2 Code is like:
    grid1.getView().hmenu.add('-',{itemId: 'Clmns', text: 'Columns', iconCls: 'x-cols-icon',
    handler: function() { //some code
    that populates data in columns portion }
    });

    I tried to use

    grid.getView().getHeaderCt().getMenu().items.add('2',{id: 'Clmns', itemId: 'Clmns', text: 'Columns', iconCls: 'x-cols-icon',
    handler: function() { //some code that populates data in columns portion }
    });

    but it gives error when clicking on menu (do not open menu at all) from firebug

    candidate.getItemId is not a function

    if (candidate.getItemId() === id) {...


    Any ideas?

    Thanks


  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    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


    You can execute getMenu() on the header to get the header menu.
    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
    Apr 2012
    Posts
    3
    Vote Rating
    0
    yurec45 is on a distinguished road

      0  

    Default


    Thank you,
    so this is right syntax?
    What value should i use for index ("-")?

    grid.getView().getHeaderCt().getMenu().items.add(index,{id: 'Clmns', itemId: 'Clmns', text: 'Columns', iconCls: 'x-cols-icon',
    handler: function() { //some code that populates data in columns portion }
    });


    Thank you.

Thread Participants: 1

Tags for this Thread