4

When using ag-grid with async data, the documentation suggest calling the api.setRowData(data) method.

The problem is that the api is ready only after the gridReady event is fired.

So I have a race condition and in order to solve I need to fetch data inside the gridReady event, which will cause an unnecessary delay.

Is this the only option ?

HDJEMAI
  • 9,436
  • 46
  • 67
  • 93
undefined
  • 6,366
  • 12
  • 46
  • 90

1 Answers1

0

It would help to see some parts of your code, but if i understand correctly this might help. I suggest to fetch data in a variable(for example data) outside of gridReady callback, and also in the same call try to set row data. if that fails and your async call returns data before grid is ready then you can do api.setRowData(data) inside your gridReady callback. that way you are sure that as soon as grid is ready and data is fetched you will have your rows populated.

Ostoja
  • 119
  • 8