remember open/closed state of filters (feature suggestion)
The title says it all: It would be nice to have a prop in PivotTableUI indicating the open/closed state of specific filters, including, possibly, their location. Something like valueFilterState, with attributes as keys and objects indicating open/closed/position state as values. Following react-draggable's Controlled vs. Uncontrolled discussion this could look something like: {[attribute]: {open: true, position: {x: number, y: number}}}. Then I guess onDrag and onStop would be added from PivotTableUI props as onDrag: (fromReactDraggable) => props.onDrag({attribute, ...fromReactDraggable}).
Sorry for the delayed responses, I'm now back from holidays and should be more reactive :)
I can certainly look into moving those from state to props but I'd like to know more about the use-case first... is it basically to be able to save and restore an analysis environment or...?
@nicolaskruchten "basically to be able to save and restore an analysis environment" Exactly. I'm storing pivot setups as "favorites". Use case would be storing that analysis setup as part of that favorite, both for data analysis experts and decision stakeholders alike. I could assign a favorite a URL endpoint and share that with filter dialogs already open to emphasize specific data explorations. The more I use react-pivottable, and the more I write this, the more I realize how powerful this would be. Having this as an optional prop for controlled mode makes sense.
FWIW, I was able to do this by pulling some attrs out of the pivot state in the PivotTableUI onChange handler, and then stuffing the attrs in a JSON encoded query parameter. In componentDidMount, I then JSON.parse that query param, and set the PivotTableUI state.
The attrs I'm pulling are:
[
"aggregatorName",
"valueFilter",
"cols",
"rows",
"vals",
"sorters",
"rowOrder",
"colOrder",
"tableOptions",
"rendererName",
]