Here’s a demo of an interactive pivot table in an Anvil app:
https://WFRNIGNPKB7G6IMG.anvil.app/XMUXHCYB22XZX6OQ65X7RL5J
You can clone the app using:
https://anvil.works/build#clone:WFRNIGNPKB7G6IMG=QYOAWQL74ZTKPOLVISUJWFGM
And here’s a screenshot of how it looks:
It uses the PivotTable.js library with the example dataset from that library’s documentation held within Anvil’s Data Tables service (2012 Canadian Members of Parliament).
When run, it will throw a deprecation warning message in the output window. This is a jQuery warning and it happens anywhere this library is used. It’s not caused by the Anvil integration.
Further work:
- The library includes many more options than I have implemented here. I’ve only done the basics.
- I had to include plotly.js in the demo app’s assets. I suspect that would cause problems if the app also uses Anvil’s plot component.
- Mucking around with css to give it a ‘Material’ look and feel. (Yuck. Not my forte)!