I've setup an ag-grid in an Angular application. I'm trying to make the single column fill in the whole width of the grid.
but then I get this.
<div class="row" ng-controller="ChapterCtrl" ng-init="currentUNID='9D2DFE6D50C53A98C1257F5900337F37'">
<div class="col-sm-4">
<div >
<div ag-grid="gridOptions" class="ag-fresh" style="height: 800px"></div>
</div>
</div>
var columnDefs = [
{headerName: "Subject", field: "Subject"}
];
$scope.gridOptions = {
columnDefs: columnDefs,
angularCompileRows: true,
Do you have any hints for me? The documentation https://www.ag-grid.com/javascript-grid-width-and-height/ didn't help me.
Many thanks!
What I'd suggest is set the grid to have a % or use vh for its width, then the grid will grow/shrink according to the parent container.
To make the columns change size, you can hook into an event an resize each time the grid size changes:
var gridOptions = {
onGridSizeChanged: () => {
gridOptions.api.sizeColumnsToFit();
}
...other gridOptions
};
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments