Satish
Satish

Reputation: 537

ui grid header menu option

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

Upvotes: 0

Views: 398

Answers (2)

Vikash B
Vikash B

Reputation: 1005

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

Upvotes: 1

Satish
Satish

Reputation: 537

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

  enableHiding: false,
  suppressRemoveSort: true

Upvotes: 1

Related Questions