Shimoku docs
Search…
⌃K

Filters

Our tables have the option to enable multiple filters, this brings a lot of flexibility to analyze subsets of data from multiple perspectives.
To activate the filters we need to provide a list of the columns that we want to use as filters and then pass that column to the input parameter filter_columns. This code generates a table with two filters:
data_ = [
{'date': dt.date(2021, 1, 1), 'x': 5, 'y': 5, 'filtA': 'A', 'filtB': 'B'},
{'date': dt.date(2021, 1, 2), 'x': 6, 'y': 5, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 3), 'x': 4, 'y': 5, 'filtA': 'C', 'filtB': 'W'},
{'date': dt.date(2021, 1, 4), 'x': 7, 'y': 5, 'filtA': 'B', 'filtB': 'T'},
{'date': dt.date(2021, 1, 5), 'x': 3, 'y': 5, 'filtA': 'A', 'filtB': 'Z'},
]
filter_columns: List[str] = ['filtA', 'filtB']
shimoku.plt.table(
data=data_,
menu_path='test/table-1',
order=0,
filter_columns=filter_columns,
)
A filtering column can't have more than 20 different values.
The result is:
Table with enabled filters
The filters can be activated by clicking on them, and selecting the desired set of values:
Activating any filter by clicking on it.
Filtering using the column filtA by the value B:
The choice of the filter appears as you select B.
The result is:
The result of a filter selection is shown.
You can rearrange alphabetically (direct or reverse order) the content of the table by clicking on a filter of your choice, in the body of the table. The result is like this:
Don't activate a column as a sorting column and a filter, the filter automatically enables sorting.
Entries sorted in ascending order using the column filtaA
Using a column as a filter and a search column is not permitted, but each column of a table can have one of the two options.
Last modified 2mo ago