lumen icon indicating copy to clipboard operation
lumen copied to clipboard

Make it possible to programmatically unselect/reset widget filter in a Notebook Pipeline

Open droumis opened this issue 1 year ago • 4 comments

Once a widget filter has been selected in a Lumen Pipeline within a notebook, there is no way to programmatically unselect or reset the filter.

ALL software version info

lumen: 0.5.0a64

Description of expected behavior and the observed behavior

A way to programmatically unselect options in a widget filter. @Hoxbro suggested: pipeline.reset_filters()

Complete, minimal, self-contained example code that reproduces the issue

import lumen
from lumen.views import Table
from lumen.pipeline import Pipeline
import panel as pn

pn.extension('tabulator', template='fast')

data_url = 'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-07-28/penguins.csv'

pipeline = Pipeline.from_spec({
    'source': {
        'type': 'file',
        'tables': {
            'penguins': data_url
        }
    },
    'filters': [
        {'type': 'widget', 'field': 'species'},
        {'type': 'widget', 'field': 'island'},
        {'type': 'widget', 'field': 'sex'},
        {'type': 'widget', 'field': 'year'}
    ],
    'transforms': [
        {'type': 'aggregate', 'method': 'mean', 'by': ['sex', 'year']}
    ]
})

pn.Row(pipeline.control_panel, Table(pipeline=pipeline, pagination='remote'))

Screenshots or screencasts of the bug in action

Screenshot 2022-09-21 at 17 33 02

droumis avatar Sep 21 '22 15:09 droumis

@droumis Doesn't pressing CTRL while clicking on a selected item unselect it?

maximlt avatar Sep 22 '22 14:09 maximlt

ahA! holding cmd (on mac) and clicking allows for unselection.. I thought I tried that on a call with Philip and Simon and it didn't work then, but now it does!

droumis avatar Sep 22 '22 14:09 droumis

Just to note, there is no programmatic way to reset your filters. Functionality like pipeline.reset_filters() could be nice to have.

hoxbro avatar Sep 22 '22 15:09 hoxbro

@Hoxbro, you are right! I edited this issue to make it reflect that a programmatic approach is requested

droumis avatar Sep 22 '22 15:09 droumis