1. #1
    Sencha User
    Join Date
    May 2013
    Posts
    78
    Vote Rating
    1
    kamalakarreddy vancha is on a distinguished road

      0  

    Default Unanswered: display context menu based on roles

    Hi....
    i created grid with context menu.
    In grid i have the data like users, Roles
    Ex: User Roles
    User1 Manager
    User2 Asst Manager
    User3 Employee

    In this i need give the permissions to the users based on their roles.
    For that i am using context menu.
    In context menu i created some common context menu.
    In this i want display the context menu based on their roles.
    For manager i want give some context menu, for employee i need display some other context menu like this......
    How to do that...
    Help me in this...
    Provide any examples also....






    Thanks in Advance
    Kamalakar Reddy

  2. #2
    Sencha Premium Member StuartAshworth's Avatar
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    359
    Vote Rating
    20
    Answers
    11
    StuartAshworth has a spectacular aura about StuartAshworth has a spectacular aura about

      1  

    Default

    You can use the 'cellcontextmenu' event and interrogate the data of the record targeted and customise the context menu displayed based on that. Something along the lines of:


    Code:
    
    onCellContextMenu: function(grid, td, cellIndex, record, tr, rowIndex){
    
    
        if(record.get('Role') === 'user'){
            // show user menu
        } else {
            // show other menu
        }
    
    
    }
    Want to build better Sencha apps? Check out my free email course Best Practices for Improving your Sencha Apps

    Learn Ext JS 6 with my new ebook - Ext JS 6: Getting Started. Use code "extjs6" for 33% off!

    Need help with Sencha development, code reviews or training? Get in touch!

    stuart@stuartashworth.com
    @StuartAshworth9

Thread Participants: 1

Tags for this Thread