Skip to content
New issue

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

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

Already on GitHub? # to your account

filter_changed is not recognised in .on() #384

Open
HariniMadhi opened this issue Mar 30, 2023 · 1 comment
Open

filter_changed is not recognised in .on() #384

HariniMadhi opened this issue Mar 30, 2023 · 1 comment

Comments

@HariniMadhi
Copy link

HariniMadhi commented Mar 30, 2023

qgrid_widget.on doesn't recognixe 'filter_changed', 'filter_dropdown_shown'.

To replicate,

import qgrid
import pandas as pd
def func(change, a):
    print(change, a)

df = pd.DataFrame({'Highlight': ['1', '1', '0', '0', '1', '0', '1', '1', '1', '1', '0', '1', '1', '1', '0'], 'Letters' :['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o']})
qgrid_widget = qgrid.show_grid(df)
qgrid_widget.on('filter_changed', func)
qgrid_widget

The need for this:
To use the filter functionality within the program (not just as a User Interface feature).
I have used the below code to defaultly show the rows that have Highlight = 1.

qgrid_widget._handle_qgrid_msg_helper({'type':'show_filter_dropdown', 'field':'Highlight', 'search_val':'1'})
qgrid_widget._handle_qgrid_msg_helper({'field':'Highlight', 'filter_info':{'field':'Highlight', 'selected':[0], 'type':'text', 'excluded':[]}, 'type':'change_filter'})

But this reduces the size of the table, and when I use the filter to include the 0 as well, the dataframe populates only to the reduced height, and no scroll bar is available.
So I want to capture when the user is again clicking the filter in func(), and then call this

qgrid_widget._handle_qgrid_msg_helper({'field':'Highlight', 'filter_info':{'field':'Highlight','selected':[], 'type':'text', 'excluded':[]}, 'type':'change_filter'})

or

call qgrid.show_grid(df) in func.

@HariniMadhi
Copy link
Author

Can somebody answer this? I've noticed the same response with 'text_filter_viewport_changed'

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

No branches or pull requests

1 participant