Dynamically changing GroupFilter.group does not update table view

I am trying to use CDSView with a GroupFilter(…) instance in a DataTable. It looks like an awesome abstraction. But I have some trouble make it work for my dynamic case.

The initial view is properly filtered per my initial group specifier. I have a Select() widget which I wanted to use to control which group is displayed in the table. I tried both Python side and JS side linking, and I verified that the view’s group attribute gets updated. But the table does not update.

Is this supposed to work? Am I missing something? Bug? Unfinished feature?

Relevant code:

    options = sorted(df.col1.unique())
    select = Select(title='Please chose:', value=options[0], options=options)
    cds = ColumnDataSource(df)
    group_filter = GroupFilter(column_name='col1', group=select.value)
    view = CDSView(source=cds, filters=[group_filter])
    columns = [TableColumn(filter=n, title=n) for n in df.columns]
    table = DataTable(columns=columns, source=cds, view=view)

I tried to link the selection in the following two ways, none of them achieving an update to the table upon selection change:

Python side:

    select.on_change('value', lambda a, o, n: group_filter.update(group=n))

Browser side:

    select.js_link('value', group_filter, 'group')

Similarly to https://github.com/bokeh/bokeh/issues/7273, it’s probably just a case of missing wiring. Please feel free to create an issue for that.

Agree that if it is not updating to in response to change that is just a bug to be fixed.

Yes, I looked at the code (filers.ts) since and there is no sign of any connect calls. I will write a ticket. May even try to fix it. Just wanted to be sure the intent is clear. I see Matt has reworked the code ~15d ago.

1 Like