muonw / muonw-powertable

▦ PowerTable is a Svelte component that turns JSON data into an interactive HTML table. Inspired by DataTables. Powered by Svelte.
https://muonw.github.io/muonw-powertable/
Other
218 stars 13 forks source link

Refreshing remote data #37

Closed smashmiek closed 8 months ago

smashmiek commented 8 months ago

Firstly, big thanks for this library.

Is there a way to manually trigger a refresh of a remote data feed?

I have a button on each row which I'm rendering with a custom svelte component. The button triggers an API call that changes the data in the backend, but I would like to be able to reflect that change in the front-end.

I was wondering if there is any way to trigger powerTable to get new data?

Thanks

muonw-public commented 8 months ago

You have a component similar to this:

<PowerTable {ptInstructs} {ptOptions} {ptData} />

Once you update the backend, re-fetch the new values and reassign the props (e.g. ptData = myNewData).