Hey guys,
I am using infinite row model for my table because my table is quite large (100k+ rows). In simple example it works like a charm BUT there is a catch!
I have a fancy UI for filtering the dataframe which have to be involved. In simple pseudocode my callback looks like this:
@app.callback(
Output("my-table", "getRowsResponse"),
Input("my-table", "getRowsRequest"),
Input("fire_filters", "n_clicks"),
State("filters", "value"),
)
def update_table(request, n_clicks, filters_data)
filtered_df = # here I filter my df using filters
partial = filtered_df .iloc[request["startRow"] : request["endRow"]]
return {"rowData": partial.to_dict("records"), "rowCount": len(filtered_df .index)}
Problem occurs i.e. in this example:
- Initially I filter in my externals filters dataframe with 300 rows, table is initialized correctly
- I scroll down, startRow 100 and endRow 200 are provided, table is updated correctly
- Now I change my external filters to data with only 70 rows, I hit the fire filters button. After hitting the button startRow 100 and endRow 200 are provided.
I would like to work with startRow 100 and endRow 200. So using ctx when fire_filters is triggered I use it through my callback with values I need. Everything in callback runs correctly, partial looks as it should but rowData does not get updated. Interestlingly rowCount is updated to 70 so I see 70 rows but with the previous data.
I believe that problem is that startRow and endRow are not updated but I have no idea how to do that. I even tried to use scrollTo and the table scrolls to row 0 but it has no impact. Any other triggering the callback takes the same values 100 for startRow and 200 for endRow.
Any help would be appreciated Thanks