0
votes

enter image description here

I am using Angular 9 and I have installed all necessary ag-grid packages.

Package.json:

"ag-grid-angular": "^23.1.1",
"ag-grid-community": "^23.1.1",
"ag-grid-enterprise": "^24.0.0"

For ag-grid-enterprise i have added license and which i have imported into main.ts

main.ts

// other imports...

import {LicenseManager} from "ag-grid-enterprise";
LicenseManager.setLicenseKey("license key");

// bootstrap your angular application. ie: platformBrowser().bootstrapModuleFactory(..)

And imported ag-grid-enterprise in the app module and imported styles into style.scss too

import 'ag-grid-enterprise';

import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-alpine.css';

I have tried to display RowGrouping table and simple table also. Please find some sample code below Html:

<ag-grid-angular
style="width: 500px; height: 150px;"
class="ag-theme-alpine"
[rowData]="rowData"
[columnDefs]="columnDefs">
</ag-grid-angular>

ts:

   import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.scss' ]
})
export class AppComponent  {

    columnDefs = [
        {field: 'make' },
        {field: 'model' },
        {field: 'price'}
    ];

    rowData = [
        { make: 'Toyota', model: 'Celica', price: 35000 },
        { make: 'Ford', model: 'Mondeo', price: 32000 },
        { make: 'Porsche', model: 'Boxter', price: 72000 }
    ];

}

I'm getting below error and table not loading when launch the application into browser. Also Find the screenshot for reference.

TypeError: details.rootNode.updateHasChildren is not function
1
why you are importing community and enterprise versions both?sandeep joshi

1 Answers

0
votes

All the code you've sent looks fine, the only thing that does look strange is your package.json.

You should be keeping all the versions consistent, i.e. if using v23.1.1, then ag-grid-commmunity, ag-grid-enterprise, and ag-grid-angular must all be v23.1.1.

I would change the package.json to this, and see if it helps:

"ag-grid-angular": "^23.1.1",
"ag-grid-community": "^23.1.1",
"ag-grid-enterprise": "^23.1.1"