Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid how do I only allow a user to have the option

    I have a listgrid with 10 columns. 5 are shown, 5 are hidden.
    when a user right clicks on a listGridField header, column header, a menu pops up (a context menu?).

    In the menu there are options for:
    Sort Ascending
    Sort Descending
    Configure Sort
    Auto Fit All Columns
    Auto Fit
    Columns ->
    Group by <column name>
    Freeze <column name>

    I only want to allow the user to see the "Columns" option so they can show and hide columns.

    So, how do I turn the others off? How do I disable them?



    I have tried:

    ListGrid lg = new ListGrid();

    lg.setFields( listgridfield... );

    then lg.getContextMenu() however, this returns null.

    I have tried listGrid.getHeaderContextMenu() this returns null as well.

    Please give me some direction on how to accomplish my goal.






    #2
    You can turn off these features on by one: canSort, canGroupBy, canAutoFitFields, canFreeze. Alternatively, you can override getHeaderContextMenuItems() and trim down to just the item you want.

    Comment


      #3
      thank you for you response but the issue remains that the listGrid.getContextMeu() and listGrid.getHeaderContextMenu() return NULL.
      The method you refer to does not exist: listGrid.getHeaderContextMenuItems(); <- no such method.

      So how do I get the Menu so that I can use menu.setCanSort(false), menu.setCanFreezeFields(false), etc...

      Please give me a code example to point me in the right direction...

      Comment


        #4
        Hi siegersallee,

        the setters Isomorphic mentioned are on ListGrid.

        Best regards
        Blama

        Comment


          #5
          listGrid.getHeaderContextMenuItems is right there in the JavaDoc.

          As Blama, mentioned, the other setters are on ListGrid.

          getContextMenu() would be expected to return null unless you had called setContextMenu().

          getHeaderContextMenu() will return the auto-created header context Menu that was most recently shown, only after it has been shown. It would be expected to return null if no Menu has been shown yet, but regardless, you have no reason to call this API.

          Comment

          Working...
          X