user2695543
user2695543

Reputation: 111

UI-Grid auto resize columns width after column hiding

In the AngularJS UI-grid I would like to auto resize columns after I click to one column hiding, because now if I click to hide clumn there will be a empty place at the place where the column was.

enter image description here

Upvotes: 0

Views: 1211

Answers (1)

Kathir
Kathir

Reputation: 6196

This will most probably because you are setting the column width in you columnDef. The reason the demos work are because they dont specify the column width and they just resize after the columns are hidden. Check you column def and make sure you are not setting the column width.

 columnDefs: [
      { name: 'name',width:150 },
      { name: 'gender', enableHiding: false,width:150 },
      { name: 'company',width:150 }
    ],

 columnDefs: [
      { name: 'name' },
      { name: 'gender', enableHiding: false },
      { name: 'company' }
    ],

There will be differences in the behavior with the above configs.

Upvotes: 1

Related Questions