Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

683
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda