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

677
Vistas
AG-Grid async valueGetter? (always returns [object Promise])

I'm using AG-Grid (in React, but an explanation in any framework will do) and have a custom 'valueGetter' applied to my colDef that carries out a calculation/format on the cell value before returning it to be displayed in the cell.

Current (functions as expected):

const defaultColDef = {
  valueGetter: (params) => {
    const result = doCalcFormat(params);  //doCalcFormat applies calculations and formats
    return result;
    },
 }

I'm trying to add the ability for the 'doCalcFormat' func to be asynchronous so that inside of it can get data from an API, then calculate/format with that data, and then return the final value to the valueGetter.

However, when I apply the async keyword to my valueGetter, all of my cells are filled with [object Promise] instead of the actual value

Attempting:

const defaultColDef = {
   valueGetter: async (params) => {             //added 'async'
    const result = await doCalcFormat(params);  //an async version of 'doCalcFormat()' was made
    console.log(result);                       //always logs expected result
    return result;
   },
}

async function doCalcFormat(params) {
    const res = await loadDataFunction();   //async func
    return res;
}

But when table loads:

enter image description here //table fills with [object Promise]

My question is, why does this happen and how could I wait for 'doCalcFormat' to finish its operation before returning in my valueGetter? Even if I leave 'doCalcFormat' to be a normal function it still does this same thing, making me think the 'async' in valueGetter is throwing it off

about 4 years ago · Juan Pablo Isaza
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