3

I use react Ag Grid library and ı work 1920*1080 screensize. So I need use responsive column width for another screensize.

               { headerName: "Sıra", field: "", width: 30, minWidth: 10, maxWidth: 300, suppressSizeToFit: false },
               { headerName: "Subscriber No", field: "", width: 130, minWidth: 10, maxWidth: 450, suppressSizeToFit: false },
...
] ```

I tried percantage instead of "30" but it doesn't work. How can I set percentage value for responsive design in Ag Grid? 
Ali
  • 305
  • 3
  • 14

1 Answers1

2

I recommend calling gridApi.sizeColumnsToFit(); in your onGridReady callback. This will adjust the size of all columns to exactly fill in the available width of the grid. When you set the width property of the column definition to 30, it is in pixels, not percent.

Matt H
  • 1,795
  • 1
  • 7
  • 8