Track data changes
About
This PR fixes https://github.com/plotly/dash-pivottable/issues/10 and as a bonus side-affect makes all of the previously read-only properties of the dash_pivottable.PivotTable writeable.
Description of changes
- The first commit fixes some pre-existing pylint issues
- The second commit updates
usage.pyto demonstrate that changes todataare not being picked up by the pivot table. - The third commit fixes that by using
propsvalues and not writing tostateas inspired by the following console warning emitted when loadingusage.py:
Warning: PivotTable: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.
in PivotTable (created by CheckedComponent)
in CheckedComponent (created by BaseTreeContainer)
in ComponentErrorBoundary (created by BaseTreeContainer)
in BaseTreeContainer (created by Context.Consumer)
in Unknown (created by BaseTreeContainer)
in div (created by u)
in u (created by CheckedComponent)
in CheckedComponent (created by BaseTreeContainer)
in ComponentErrorBoundary (created by BaseTreeContainer)
in BaseTreeContainer (created by Context.Consumer)
in Unknown (created by UnconnectedContainer)
in div (created by UnconnectedGlobalErrorContainer)
in div (created by GlobalErrorOverlay)
in div (created by GlobalErrorOverlay)
in GlobalErrorOverlay (created by DebugMenu)
in div (created by DebugMenu)
in DebugMenu (created by UnconnectedGlobalErrorContainer)
in div (created by UnconnectedGlobalErrorContainer)
in UnconnectedGlobalErrorContainer (created by withRadiumContexts(UnconnectedGlobalErrorContainer))
in withRadiumContexts(UnconnectedGlobalErrorContainer) (created by ConnectFunction)
in ConnectFunction (created by UnconnectedContainer)
in UnconnectedContainer (created by ConnectFunction)
in ConnectFunction (created by UnconnectedAppContainer)
in UnconnectedAppContainer (created by ConnectFunction)
in ConnectFunction (created by AppProvider)
in Provider (created by AppProvider)
in AppProvider
- The fourth commit the readme to say that changes to all the previous read-only only pivottable values can now be written to whilst also updating
usage.pyto demonstrate that is indeed now possible.
Pre-Merge checklist
- [ ] The project was correctly built with
npm run build:all. - [ ] If there was any conflict, it was solved correctly.
- [ ] All changes were documented in CHANGELOG.md.
- [ ] All tests on CircleCI have passed.
- [ ] All Percy visual changes have been approved.
- [ ] Two people have :dancer:'d the pull request. You can be one of these people if you are a Dash Pivottable core contributor.
Reference Issues
Fixes #10
The build is failing due to pylint failing to run (e.g. here) which is due to this restriction on asteriod.
If I remove that line then pylint locally runs fine.
@alexcjohnson @nicolaskruchten - Is there anything outstanding with this PR? Considering that issue #10 was first opened in 2019 and this is (imo) a major pain-point in working with this component (which is otherwise a great add to the Dash toolkit), it would be great if we could prioritize getting this merged to master and released.
@chriddyp any chance you could help move this PR along?
Any resolution to get this merged in?
Hey@AdrianIssott,
I applied your changes for my pivot table but I filter my columns or rows, the valueFilter argument is still empty on my callbacks. Does it work for you or did I understand its functionality wrong?
I applied your changes for my pivot table but I filter my columns or rows, the valueFilter argument is still empty on my callbacks. Does it work for you or did I understand its functionality wrong?
@candas-unal-work, it does work for me. I updated usage.py to demonstrate that so I suggest you check if that works for you too or not.
@AdrianIssott OK this is interesting:
When I tried the usage.py with your changes it worked properly, and I've been trying to understand what I was missing in my app. I finally solved the problem by declaring the pivot table initially with an empty valueFilter as valueFilter=dict(). Now I can retrieve the filtered values in columns and rows, and if I don't pass an empty dictionary, I get an empty list.
Thank you.
Well that's not great and suggests an improvement is needed on this PR. However, there's little point in me doing that given it's totally stalled
I understand. But thank you again for the PR, it solved my many problems @AdrianIssott .
How could this project be revived?
I think pivot table is a great tool, has a lot of potentials but the people at plotly are not as interested, or so it seems. @alexcjohnson @nicolaskruchten .