Loading array of objects with loadData() only works when calling loadData() twise

Tags: #<Tag:0x00007f8b1ae6ded8>

The following code works, but if I remove the second call to loadData(), the table is just cleared, and no data is displayed. Am I doing something wrong?

    document.getElementById('refresh').onclick= () => {
        fetch('http://localhost:8080/v1/graphql', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' 
        },
        body: JSON.stringify({ query: 'query MyQuery { scomexp { id fqdn objecttype } }' }), })
        .then(res => res.json())
        .then(res => {
            d = res.data.scomexp;
            handsontable.loadData(d);
            handsontable.loadData(d);
        });
    }

Hey @danhje

have you tried to add a slight delay (~100ms) to the first loadData() call?
If that doesn’t help I would need to get a demo for tests.

Hey @danhje
any updates?

Hi,

Adding a delay makes no difference.

Daniel

Would you be able to send over a demo for tests?

I simply destroy and recreate the table instead, which I think is ok for my application.

1 Like

Great to hear that you’ve found a way to work it out.
I’m closing the ticket as there are no further questions.