Tom Tester
Tom Tester

Reputation: 31

How to disable resize for specific column in angular ui-grid

Here is my column def

$scope.gridOpts = {
enableColumnResizing: true,
columnDefs : [
   {displayName:"Name",field:"name",width:'20%'},
   {displayName:"Gender",field:"gender",width:'*'},
   {displayName:"Company",field:"company",width:'60%'}
  ],
data: [
  { "name": "Ethel Price", "gender": "female", "company": "Enersol" },
  { "name": "Claudine Neal", "gender": "female", "company": "Sealoud" },
  { "name": "Beryl Rice", "gender": "female", "company": "Velity" },
  { "name": "Wilder Gonzales", "gender": "male", "company": "Geekko" }
]};

I would like to disable resizing on the last column (company), the current solution works okay but starts truncating and adding ellipsis when the window is reduced to a certain point.

Upvotes: 3

Views: 2835

Answers (1)

To disable the last column resizing set last column property enableColumnResizing to false.

columnDefs : [
       {displayName:"Name",field:"name",width:'20%'},
       {displayName:"Gender",field:"gender",width:'*'},       {displayName:"Company",field:"company",width:'60%',enableColumnResizing:false}
      ]

Adding ellipsis while resizing is expected behaviour.

If you want to control that behavior you have to set the minWidth property to the column definition.

Upvotes: 2

Related Questions