1. #1
    Ext User
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    12
    Vote Rating
    0
    Mahendru is on a distinguished road

      0  

    Default Sortable Columns: Remove 'Sort Ascending,' 'Sort Descending' Options

    Sortable Columns: Remove 'Sort Ascending,' 'Sort Descending' Options


    Hi,

    Since I am able to sort the columns by just clicking on the headers, I would like to remove the two options given in the title of this post. Would that be possible?

    Sincerely,
    Jay M.

  2. #2
    Ext JS Premium Member troseberry's Avatar
    Join Date
    Feb 2010
    Location
    Dayton, OH
    Posts
    277
    Vote Rating
    9
    troseberry will become famous soon enough

      0  

    Default


    I believe this is the command you need to setup on your column
    Code:
    menuDisabled: true

  3. #3
    Sencha User darthwes's Avatar
    Join Date
    Mar 2010
    Posts
    633
    Vote Rating
    -11
    darthwes can only hope to improve

      0  

    Default


    FYI, you can set defaults on column models.

    Code:
    new Ext.ColumnModel({
      defaults: {
        sortable: true,
        menuDisabled: true
      },
      columns: [...]
    })
    Wes

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by troseberry View Post
    Code:
    menuDisabled: true
    Yes, but that will disable the entire menu (including the column and/or grouping menu items).

    Instead, you could hide the 'asc' and 'desc' menu items from the hmenu (from the viewready event).

  5. #5
    Ext User
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    12
    Vote Rating
    0
    Mahendru is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Yes, but that will disable the entire menu (including the column and/or grouping menu items).

    Instead, you could hide the 'asc' and 'desc' menu items from the hmenu (from the viewready event).
    Thanks everyone. The menuDisabled option works but for some columns I'd still like to retain some features, like enabling columns that were initially hidden. That being said, Condor, could you please elaborate on your post. Where can I find more information about the viewready event?

    Thanks,
    Jay M.

  6. #6
    Sencha User darthwes's Avatar
    Join Date
    Mar 2010
    Posts
    633
    Vote Rating
    -11
    darthwes can only hope to improve

      0  

    Default


    viewready on grid.

    grid.getView().hmenu

    has items that can .hide and .show...

    GL
    Wes

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Code:
    grid.on('viewready', function(){
      grid.getView().hmenu.getComponent('asc').hide();
      grid.getView().hmenu.getComponent('desc').hide();
    });
    Disclaimer: Completely untested code!

  8. #8
    Ext User
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    12
    Vote Rating
    0
    Mahendru is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Code:
    grid.on('viewready', function(){
      grid.getView().hmenu.getComponent('asc').hide();
      grid.getView().hmenu.getComponent('desc').hide();
    });
    Disclaimer: Completely untested code!
    Thanks Condor and Wes. It works great!!

  9. #9
    Sencha User
    Join Date
    Jun 2012
    Posts
    48
    Vote Rating
    0
    mandardadpe is on a distinguished road

      0  

    Default


    I have added same code , but I am getting error as "Uncaught TypeError: Cannot call method 'getComponent' of undefined "



    What I suppose to do?

  10. #10
    Sencha User darthwes's Avatar
    Join Date
    Mar 2010
    Posts
    633
    Vote Rating
    -11
    darthwes can only hope to improve

      0  

    Default


    wait for it to render...
    Wes

Similar Threads

  1. Sort ascending and descending.
    By oasisjoel in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 6 May 2009, 10:35 PM

Thread Participants: 4