glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
740 stars 153 forks source link

Add filter/search to table viewer #2392

Closed jfoster17 closed 1 year ago

jfoster17 commented 1 year ago

Add filter/search to the Table Viewer

table_filter

Description

This PR adds a search/filter field and component selection widget to the Table Viewer. The displayed elements in the table are then filtered based on applying re.search() to the selected component. The primary motivation is to allow the user to use the GUI to find matching rows in a dataset and create a subset from those rows. I limit the user to searching on categorical components.

This necessitated adding a TableViewerState in order to keep track of the things going into the filter.

I experimented with using QSortFilterProxyModel just for the filtering and although I was able to get a working implementation, I was then getting frequent segfaults that I was unable to diagnose. Since we are already doing sort within our custom DataTableModel it was easy enough to apply the filtering here as well. (I also that using QSortFilterProxyModel was rejected in b7a0f67500 for performance concerns, but performance seemed okay for the filtering component).

Still to do:

Closes #2386

astrofrog commented 1 year ago

Very nice! Let me know once you would like me to review this :) One request is whether we could hide the search box by default and have a viewer tool with a 'funnel' icon for filtering that when clicked would toggle the search box?

jfoster17 commented 1 year ago

Very nice! Let me know once you would like me to review this :) One request is whether we could hide the search box by default and have a viewer tool with a 'funnel' icon for filtering that when clicked would toggle the search box?

I considered that. I think that it is better to have the search box by default because

  1. It does not take up that much space
  2. The "default" reason to open up a Table Viewer is to identify specific rows (perhaps the most common reason is actually to get a look at your dataset, but finding specific items is probably the second most common reason)

Thus I think the friction of requiring a user to correctly identify and toggle the 'funnel' item for the most common interaction with a table is not worth the marginal cost of having a little bit less space in the viewer for showing the data.

jfoster17 commented 1 year ago

@astrofrog -- this is ready for your review.

I presented at our glue weekly meeting and they were fine with having the search bar be shown all the time. The main request was to be able to toggle the regex search so that users won't be tripped up if they want to search for unescaped special characters; I have now added this button.