Angular Data GridGetting Values

angular logo

Values are mapped into Cells using either field or valueGetter from the Column Definition.


The Column Definition field property maps values from the row data object to the Column's Cells.

The field supports dot notation (e.g. to access properties of complex objects.

    /* other grid options ... */>

this.rowData = [
        athlete: 'Michael Phelps',
        medals: {
            gold: 8, silver: 1, bronze: 0

this.columnDefs = [
    // simple field attribute
    { field: 'athlete' },
    // using dot notation, a Header Name is usally needed
    { field: '', headerName: 'Gold' },

Value Getter

A Value Getter is a function that gets called for each row to return the Cell Value for a Column. Typically column cell values are loaded using a field, and then a valueGetter is used when retrieving the value requires custom logic. Columns with Value Getter's usually have manually provided Header Name's as the grid cannot derive Header Names from Value Getters like it does with Fields.

this.columnDefs = [
    // achieves the same as using 'athlete' for the field
    { headerName: 'Athlete', valueGetter: p => },
    // using valueGetter to combine 3 values into 1
    { headerName: 'Total Medals', valueGetter: p => + + }