dash-pivottable icon indicating copy to clipboard operation
dash-pivottable copied to clipboard

Track data changes

Open AdrianIssott opened this issue 3 years ago • 11 comments

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.py to demonstrate that changes to data are not being picked up by the pivot table.
  • The third commit fixes that by using props values and not writing to state as inspired by the following console warning emitted when loading usage.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.py to 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

AdrianIssott avatar Jul 07 '22 09:07 AdrianIssott

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.

AdrianIssott avatar Jul 07 '22 09:07 AdrianIssott

@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.

jborman-exos avatar Aug 02 '22 14:08 jborman-exos

@chriddyp any chance you could help move this PR along?

AdrianIssott avatar Sep 01 '22 13:09 AdrianIssott

Any resolution to get this merged in?

jaapaap79 avatar Dec 28 '22 20:12 jaapaap79

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?

candas-unal-work avatar Jan 05 '23 08:01 candas-unal-work

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 avatar Jan 05 '23 08:01 AdrianIssott

@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.

candas-unal-work avatar Jan 06 '23 10:01 candas-unal-work

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

AdrianIssott avatar Jan 06 '23 10:01 AdrianIssott

I understand. But thank you again for the PR, it solved my many problems @AdrianIssott .

candas-unal-work avatar Jan 06 '23 11:01 candas-unal-work

How could this project be revived?

jaapaap79 avatar Jan 07 '23 16:01 jaapaap79

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 .

candas-unal-work avatar Jan 11 '23 04:01 candas-unal-work