panel icon indicating copy to clipboard operation
panel copied to clipboard

List header filter fails to find matching rows in 1.5.0

Open bbercoviciUspace opened this issue 1 year ago • 3 comments

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 Screenshot from 2024-09-26 16-45-50

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. Screenshot from 2024-09-26 16-46-12

The inspect window shows the following warning :

image

bbercoviciUspace avatar Sep 26 '24 14:09 bbercoviciUspace

Could you add your code to the issue so there is an MRE that can be tested easily?

Coderambling avatar Oct 01 '24 06:10 Coderambling

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

Screenshot from 2024-10-01 13-51-00

test_panel_buggy.zip

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")

Screenshot from 2024-10-01 13-52-57 test_panel_fixed.zip

I'm positive that this fix became necessary sometime around when panel 1.5.0 rolled out.

bbercoviciUspace avatar Oct 01 '24 11:10 bbercoviciUspace

Good find!

Coderambling avatar Oct 05 '24 13:10 Coderambling

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.

github-actions[bot] avatar Dec 16 '25 01:12 github-actions[bot]