Sorting/ filtering still doesn't work in dash table after issue 202 is fixed

Hi all,

The issue, 202, (https://github.com/plotly/dash-table/issues/202#issuecomment-436750407) is supposed to have fixed the sorting bug in dash table but I’m still facing the same issue.

I tried using a dummy callback which has been suggested before. The sample code is below. This doesn’t change any behavior. I have also tried to output the table to the Div container. In this case, the sorting just works once. I believe since it is not connected to the callback anymore, the sorting click doesn’t respond.

And finally, I also tried the back end sorting using “sort_by” attribute and that is not working either.

Any help is appreciated on this!

Front end Sorting code

    html.Div(id='table',
             children=dash_table.DataTable(id='df_table',
                                           columns=[{"name": i, "id": i} for i in df_sub.columns],
                                           data=df_sub.to_dict('records'),
                                           style_as_list_view=True,
                                           sorting=True
                                           ))

@app.callback(Output('df_table', 'data'),
              [Input('df_table', 'derived_virtual_data')])
def dummy_fx(rows):

    dff = df if rows is None else pd.DataFrame(rows)

    return dff.to_dict('records')

Back end sorting code (callback)

@app.callback(Output('df_table', 'data'),
              [Input('df_table', 'sort_by')],
              [State('df_table', 'data')])
def dummy_fx(sort_by, rows):
    
    dff = pd.DataFrame.from_dict(rows)

    if sort_by:
        dff = dff.sort_values(
            sort_by[0]['column_id'],
            ascending=sort_by[0]['direction'] == 'asc',
            inplace=False
        )

    return dff.to_dict('records')