Angular 6 and Ag-grid

后端 未结 2 1859
梦谈多话
梦谈多话 2021-01-16 13:43

I\'m doing a test with Angular 6 and Ag-Grid. I have done an example and it paints it, I mean the css and so on.

But by doing the example below and enter the real da

2条回答
  •  不知归路
    2021-01-16 14:10

    First, you need to understand the flow:

    rowData - is immutable - you can't manipulate with is as with array, you can just re-create it. More info

    you need to avoid using gridOptions for any action - it's only for init-configuration, for anything else - you need to use gridApi - which could be accessed on onGridReady function

    (gridReady)="onGridReady($event)"
    ...
    onGridReady(params) {
        this.gridApi = params.api;
        this.gridColumnApi = params.columnApi;
        let youData = [];
        this.competences.forEach((competence) => {
            youData.push({id: competence.id, name: competence.desc});
        });
        this.gridApi.setData(youData);
    }
    

提交回复
热议问题