0

I would like to hide one of the header menus option from ui-grid, I don't want to display "Hide Column" option in enableFiltering

 enableFiltering: true,
 enableColumnMenus:false

enableColumnMenus:false is hiding entire menu from header which doesn't suits with my requirement, I can achieve this with css by display none option for it, but I would like to do it from javascript end,can someone please help me on thisUI-GRID

Satish
  • 537
  • 2
  • 9
  • 21

2 Answers2

1

You can use enableHiding as false in your columnDefs. For example:

columnDefs: [
  { field: 'name' },
  { field: 'gender', enableHiding: false, suppressRemoveSort: true, 
                     sort:  {direction: uiGridConstants.ASC }}]

For more details check this link Customizing Column Menu - UI Grid

I don't think you can give this at grid level. i.e in $scope.gridOptions

Vikash B
  • 945
  • 12
  • 26
  • ~vikash, Thanks for update enableHiding option working on load but when we click on sort options in the menu remove sort is coming extra and I don t want to use this in columnDefs – Satish Sep 29 '16 at 12:12
  • Hope using suppressRemoveSort:true solves your issue. I will update my answer as well. – Vikash B Sep 29 '16 at 13:07
1

We can make it columnDefs not gridOptions level we need to use suppressRemoveSort along with enableHiding

  enableHiding: false,
  suppressRemoveSort: true
Satish
  • 537
  • 2
  • 9
  • 21