I have an ag-grid table, and I have a column in it with value formatter:
{
headerName: "My column",
valueFormatter: getFormattedIndexValue,
...
}
From getFormattedIndexValue I try to call async function:
async function getFormattedIndexValue (params) {
if (!params.value) return;
return await getDecodedValue(table, params.colDef.field, params.value);
}
This is the code of async function, I try to call:
async function getDecodedValue(table, field, value) {
const query = `function=decode&table=${table}&field=${field}&value=${value}`;
const response = await fetch('routines.php', { method: 'post', body: query, headers: {"Content-Type": "application/x-www-form-urlencoded"}});
return response.text();
}
But in this way valueFormatter doesn't return correct value, resulting in [Object Promise]. Is there a way to call async function from valueFormatter and to get proper result