Hey everyone,
I have a dash AG Grid table and it gets populated with an api call.
@callback(
[
Output("bulk-table", "rowData", allow_duplicate=True),
Output("num_of_agreements", "children"),
],
[
Input("filter1", "value"),
],
prevent_initial_call=True,
)
def update_table(selected_filter: str) -> list:
if selected_filter:
all_data = []
next_id = None
try:
while True:
pa = api.get_data(
selected_filter=selected_filter,
from_id=next_id,
)
flat = [flatten_data(test_data) for test_data in pa['items']]
for sublist in flat:
for item in sublist:
all_data.append(item)
next_id = pa['next_id']
total = pa['total']
if next_id is None:
break
except Exception:
return [], 0
if not all_data:
return [], 0
return all_data, total
return [], 0
it’s using pagination in the backend. And what it does, it just is making the calls as long as there is a next_id.
What I would like to have is to load the data in the table as it receives data. So the table gets populated as new data comes in, or make it in batches or similar.
Also in the data I receive the total and how many are loaded.
Can I show somehow in a component ‘X out of total loaded’.
I have tried with the total to show it, but now it only shows the total AFTER the callback is finished and all data returned (the total number is available in the data from the first load).
Is there any component that dynamically changes?