List header filter fails to find matching rows in 1.5.0
ALL software version info
- panel 1.5.0 pyhd8ed1ab_0
- python 3.10.*
Description of expected behavior and the observed behavior
The list header filters are no longer working.
Instead of extracting the relevant rows, filling the filter empties the panel and triggers a warning in the browser console. This issue manifested itself after upgrading from 1.4.5 to 1.5.0.
Complete, minimal, self-contained example code that reproduces the issue
Column header filters defined as list filters, such as the following applied to the processName column
"processName": {
"type": "list",
"valuesLookup": True,
}
are not working properly in 1.5.0.
Stack traceback and/or browser JavaScript console output
Screenshots or screencasts of the bug in action
1.4.5 : the filter extracts the expected rows
No warning is shown in the inspect window
1.5.0 : the filter clears the entire table although there are rows matching the pattern in the dataset.
The inspect window shows the following warning :
Could you add your code to the issue so there is an MRE that can be tested easily?
I think I found a fix while trying to come up with a minimum example:
import panel as pn
import pandas as pd
import string
filters = {
"field_A": {
"type": "list",
"valuesLookup": True,
"placeholder" : "list"
},
"field_B": {
"type": "input",
"placeholder" : "input"
}
}
data = list()
for i in range(100):
data.append(dict(field_A = string.ascii_lowercase[i % len(string.ascii_lowercase)], field_B = string.ascii_lowercase[(i + 3) % len(string.ascii_lowercase)]))
dataframe = pd.DataFrame(data)
panel_args = dict(value = dataframe,layout="fit_data_table", header_filters=filters)
tabulator = pn.widgets.Tabulator(**panel_args)
tabulator.save("test_panel.html")
The above script produced the attached test_panel_buggy.html file
For reasons beyond my understanding, adding the func : "like" to the list typed header filters brings back the search results
import panel as pn
import pandas as pd
import string
filters = {
"field_A": {
"type": "list",
"func": "like",
"valuesLookup": True,
"placeholder" : "list"
},
"field_B": {
"type": "input",
"placeholder" : "input"
}
}
data = list()
for i in range(100):
data.append(dict(field_A = string.ascii_lowercase[i % len(string.ascii_lowercase)], field_B = string.ascii_lowercase[(i + 3) % len(string.ascii_lowercase)]))
dataframe = pd.DataFrame(data)
panel_args = dict(value = dataframe,layout="fit_data_table",header_filters=filters)
tabulator = pn.widgets.Tabulator(**panel_args)
tabulator.save("test_panel.html")
I'm positive that this fix became necessary sometime around when panel 1.5.0 rolled out.
Good find!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.