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

Apply filter by defaul #39

Closed
jorgelaranjo opened this issue Jun 18, 2018 · 5 comments
Closed

Apply filter by defaul #39

jorgelaranjo opened this issue Jun 18, 2018 · 5 comments

Comments

@jorgelaranjo
Copy link

Is there any way to apply the 'filter' from PivotTableJs directly on Python, eg, have a bunch of data but by default apply a filter to it, so that all data is available but only some is on display by default?

@nicolaskruchten
Copy link
Owner

Yes, you can use the inclusions/exclusions parameters of PivotTable.js: https://github.com/nicolaskruchten/pivottable/wiki/Parameters#options-object-for-pivotui

@jorgelaranjo
Copy link
Author

jorgelaranjo commented Jun 18, 2018

@nicolaskruchten
Thanks. But not clear how the pivot_ui filter passes the item implicitly to the function

def foo_bar_func(list):
    if(df.Col6.isin(list)): return True #Cannot be df, needs to be the item from pivot_ui
    else: return False

pivot_ui(df, 
         cols =['Col1'],
         rows=['Col2','Col3','Col4', 'Col5'], 
         vals=['Col6'],
         rendererName = 'Table',
         aggregatorName = 'Sum',
         filter = foo_bar_func([1,2,3]) #how is the item passed to the function?
        )

@nicolaskruchten
Copy link
Owner

You need to use inclusions and exclusions, not filter :)

@jorgelaranjo
Copy link
Author

jorgelaranjo commented Jun 18, 2018

👍 That explains it :) Works well now :)
Guess we can close this 'issue'.

Surely there's a better way to ask questions than opening 'issues'?

@nicolaskruchten
Copy link
Owner

Glad this works now. Github Issues is actually my preferred way of doing things: I have a good workflow for managing Github notifications and it leaves a trail of hints for other people who have similar questions in the future. As a result, I refuse to deal with this kind of thing via private email. You can try your luck on StackOverflow, and I occasionally glance there but my goal is for the Issues here to be an accumulation of all knowledge/conversation about this project :)

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

2 participants