finos / perspective

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.
https://perspective.finos.org/
Apache License 2.0
7.72k stars 1.04k forks source link

Question: How to reset the Persepective Viewer component? #2586

Closed tobilg closed 2 months ago

tobilg commented 2 months ago

Not a bug report, but a question: How can I reset the Perspective Viewer components configuration? I use is in my https://sql-workbench.com project to show resultsets from DuckDB WASM (via Arrow).

When I run different queries, I sometimes see some strange behavior (no scrolling possible, view not updating etc.). Once I click on reset in the component, everything works again. Unfortunately I failed to understand how this can be achieved programmatically...

Basically, I run the following code once a query succeeded:

// Load Apache Arrow data as table
const table = await worker.table(buffer);

// Load table
await viewerRef.current.load(table);

The schema of the Arrow data in buffer can change with every query. How can I programmatically reset the table's view, so that the same thing happens internally as pressing the "Reset" button in the component itself=