Hey Paulo,
I figured that out after posting, and it sometimes works, but not always. There seems to be a race condition between the table loading and the JS reading the table data.
Order of operations here is:
- SQL query gets data
- In parallel, the SQL query starts JS script, while table reads SQL query response data.
- Sometimes the JS script finishes before the table loads, but sometimes after.
Seems like there needs to be a trigger that can be called after the table finishes loading from its source.
For now, I've just added a 500ms delay at the start of the JS script which is fine for this application.