nicolaskruchten / pivottable

Open-source Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.
https://pivottable.js.org/
MIT License
4.35k stars 1.08k forks source link

Add API function to get PivotData object #1271

Closed dorthrithil closed 3 years ago

dorthrithil commented 3 years ago

I wrote an external custom renderer (for exporting as XLSX) which I want to trigger via a button outside of the table. My renderer function depends on the PivotData object. It would be nice if you could add an API function to get the current PivotData from. Or is there some recommended way to get it that I missed while reading the documentation?

nicolaskruchten commented 3 years ago

There's no easy way to access this object from outside... Your best bet would be to build a renderer that displays as the table plus the button, and then your renderer would get access to the PivotData object.

dorthrithil commented 3 years ago

Thanks Nicolas! I ended up doing exactly that.