Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

345
Vistas
valueGetter is not reflecting in rowdata ag-gird

I am using ag-grid community version for my development. I came across valuegetter to render the cell data on the fly.

But it is not reflecting in the row data variable.

Below is my columndef

columnDefs = [
    { headerName: 'Student Name', field: 'name' },
    { headerName: 'English', field: 'english' },
    { headerName: 'Maths', field: 'maths' },
    { headerName: 'Science', field: 'science' },
    {
      headerName: 'Total',
      field: 'total',
      valueGetter: params => {
        let totalValue = 0;
        totalValue =
          parseInt(params.data.english) +
          parseInt(params.data.maths) +
          parseInt(params.data.science);
        return totalValue;
      }
    }
  ];

Below is my row data

rowData: StudentData[] = [
    { name: 'Rajesh', english: '10', maths: '21', science: '0', total: null }
  ];

Where I am doing the total on the fly.

But when i am trying to access the total in my row data it is not reflecting

onSave(): void {
    console.log(this.rowData[0].total);
  }

The console is printing null instead of 31

Below is my StackBlitz URL.Please help me to get the value getter value in row data model

https://stackblitz.com/edit/angular-ivy-vkppt6?file=src%2Fapp%2Fapp.component.ts

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You were only getting (presenting) the processed data.

You have to assign the data to the respective column's field/property.

So, in ValueGetter add:

params.data.total = totalValue;

Working demo

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda