Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a save/restore config through cookie in python code #34

Closed
mbkamble opened this issue Dec 29, 2017 · 5 comments
Closed

How to create a save/restore config through cookie in python code #34

mbkamble opened this issue Dec 29, 2017 · 5 comments

Comments

@mbkamble
Copy link

Hi. I read through your examples:
onRefresh example and
save_restore example

but I am unable to figure out how to create that javascript code through the pivot_ui() function call in Jupyter notebook.
I realize that pivot_ui(data, onRefresh="something") can be used but in javascript onRefresh should be assigned a callback function and as far as I could experiment, the "something" always gets passed in as string.

@nicolaskruchten
Copy link
Owner

Yes, unfortunately all parameters are currently being passed in via their JSON representation. I suppose I could hardcode certain parameters like onRefresh for special pass-through treatment such that you could do something like pivot_ui(data, onRefresh="function() { ... }") but I feel this is a bit of an edge case, as most Python developers aren't that interested in having Javascript strings in their notebooks...

Can you tell me a bit more about your specific use-case?

@mbkamble
Copy link
Author

The need arose quite soon after I installed the module and instantiated the widget in my notebook. The use case is pretty straightforward: I have a data frame from work related project that needs to be presented to relevant stake holders. During discussions, the pivot table views are interactively modified to analyze the data from different viewpoints. Most stake holders also want to independently view/interact with the data table. But each time the cell containing the pivot_ui() call is evaluated the pivot configuration is destroyed. I have used the 'rows', 'columns', 'included' etc keyword arguments to setup the first view. But it would be nice to store pivot configs created on the fly (into independent cookies or file) to avoid redoing the effort.
I thought most python notebook users using this widget would feel the need for persistent storage of the pivot views they create.

@nicolaskruchten
Copy link
Owner

I see what you're looking for, yes. This widget was mostly designed for single-user exploration, which is why it doesn't have a lot of features to support what you're looking for. I'd be open to pull-requests to add the functionality you'd like.

@mbkamble
Copy link
Author

Sure. I'll see what I can do and get back to you if I have something to demonstrate.

@iljya
Copy link

iljya commented Sep 28, 2020

What's the reason for closing this? Seems like a valid issue that other people have encountered as well, such as me and the person who posted this:
https://stackoverflow.com/questions/58452635/save-configuration-of-pivottablejs-in-jupyter-notebook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants