Using ag-grid in angularJs facing issue with column headers on basis of hide and show column functionality


Keywords:angularjs 


Question: 

I am using ag-grid in angularJs and facing issue with the headings of the columns size adjustment.

The problem comes when I show and hide columns and respectively the columns get removed and added from the table. Their size horizontally adjustment is a problem.

I have used gridOptions.api.sizeColumnsToFit(); But still problem exists.


1 Answer: 

{ headerName : "head1", 
  field : "headId", 
  suppressSizeToFit: false, 
  width: 200, 
  minWidth: 200 ... } // width is depends on width you need in app. 

The code above solves column's width issue for the columns appears using gridOptions.api.sizeColumnsToFit()