0
votes

I am stuck on this grid, I don't see the error I try every single example but it's doesn't work for me !

My problem is to set the grid fit the rows content this is my version of gridoptions

 this.gridOptions = {
      pagination:true,
      enableColResize: true,
      animateRows: true,    

    };
this.gridOptions.columnDefs = [
      {
        headerName: "Account ID",
        field: "AccountID",
        minWidth: 100
      }, ... ]

 this.gridOptions.onGridReady = () =>
    {
      this.gridOptions.api.sizeColumnsToFit();
      this.setRowData();
    }

and when the user click on the button the grid must apply this new changes

resizeWind()


     {
        this.gridOptions.api.forEachNode(rowNode => {
          if (rowNode.data) {
            rowNode.setRowHeight(100);
          }
          // console.log(rowNode.data);
        });
        this.gridOptions.api.onRowHeightChanged();
      }

Notes - Angular 4 with webpack via angular-cli

1

1 Answers

0
votes

I created a plnkr with your function... everything seems to be working fine in this example. Perhaps make sure that you have the click event binded properly?

<button (click)="resizeWind()">click me</button>