1
votes
ngOnInit(){
    this.gridOptions = {};
    this.gridOptions.rowData = [];

    this.gridOptions.rowData = [
      {configName: 1, configName1: "Jarryd", configName2: "Hayne", configName3: "tttttt", configName4: "rrrtttt",
       configName5:"drrrrrr"}];
}

Hard Coded value is loading in table. But inside service dynamic value is not loading.

this.service.getData(fields).subscribe(data => {
    data.be.forEach(element => {

        let tableData = {configName: element.configName, configName1: element.configName1, configName2: element.configName2, configName3: element.configName3, configName4: element.configName4, configName5:element.configName5}

        this.gridOptions.rowData.push(tableData )
    }
}
2

2 Answers

0
votes

I think it's better to create an internal list @

configOptions:string[];

this.service.getData(fields).subscribe(data => {
data.be.forEach(element => {

    let tableData = {configName: element.configName, configName1:   element.configName1, configName2: element.configName2, configName3: element.configName3, configName4: element.configName4, configName5:element.configName5}

    this.configOptions.push(tableData );
     this.gridOptions.api.setRowData(this.configOptions);
}
}
0
votes

Check this topic with the similar issue. It seems your way to update ag-grid isn't correct.