Render before incrementing

Tags: #<Tag:0x00007efc7197c9e8>

I need to render the data before incrementing a counter, but the counter is being incremented, so it only displays the last value, see:

this.totalMeses = 0;
if (verificaSeTemTotal && tipoCenario === ‘LONGO_PRAZO’) {
const btTotal = ‘’;
const headerContentTotal = <div class="d-flex"><span>${data[1]}</span>${btTotal}</div>;
columns.push({
def: data[1],
header: headerContentTotal,
type: ‘numeric’,
templateRef: templateRefValueCol,
content: (row) => this.teste(row, this.totalMeses),
width: this.size ? this.size : 60,
readOnly: true,
initHidden: true,
styled: false,
tipoColumn: ‘total’,
clickHeader: tipoCenario === ‘LONGO_PRAZO’ ? fnOpenColumns : null,
});
}
if (data[1] !== dataPosterior[1] && tipoCenario === ‘LONGO_PRAZO’) {
this.totalMeses++;
columns.push({
def: ‘separador’,
header: ‘’,
tipoColumn: ‘separador-2’,
templateRefHeader: templateRefSeparadorHeader,
content: () => this.separadorContent(),
templateRef: templateRefSeparador,
readOnly: true,
width: 10,
styled: false,
});
}
});
return columns;

Hi @sidney.silva

I tried to recreate your issue, but it seems that there is not enough code in your snippet. Can you please prepare a simplified code demo so I can investigate the issue further?

I have a variable that will increment and I need to display the value of an array with the index of the variable created, but the parameter “content” only takes the last value, see the example:

Hi @sidney.silva

I’m still not able to recreate the issue. Please send us a code demo created in, for example, jsFiddle so we can check it.