Dash DataTable Native Filtering on a table based on a different callback


I have a data table which I create based on a callback from a date dropdown, like this:

    Output('output-date-filtered-df', 'data'),
    [Input('input-single-date-picker', 'date')])
def update_date(date):
    if date is None:
        date_filtered_df = create_df_based_on_date('2015-08-25')
        date_filtered_df = create_df_based_on_date(date)
    return date_filtered_df.to_dict(orient='records')

From the docs, the way to create native filtering would be:

    Output('output-component-filtered-df', 'children'),
    [Input('output-date-filtered-df', 'data')])
def filter_table(rows):
    if rows is None:
        updated_df = df
        updated_df = pd.DataFrame(rows)

    return html.Div()

The initial dataframe shows fine, but when I try to use the table filtering option nothing shows. What am I missing here?


For future Reference, this works just fine, I was not using the front-end filtering correctly. Did not realize that for front-end numeric filtering you need to specify an operator (i.e. =3 rather than just 3), whereas for text values partial search worked fine.

I have changed the second callback to:

    if rows is not None:
        updated_df = pd.DataFrame(rows)
  • this is because the dataframe is pre-generated by the initial call back anyway.