I have a sqllite3 database with ~1000 entries. I want to load the entries dynamically.
My layout
for the dash datatable is :
layout = html.Div([
dash_table.DataTable(
id='datatable-testcaseinfo',
columns=[
{"name": i, "id": i, "selectable": True}
for i in self._get_column_names()
],
filter_action="native",
sort_action="custom",
sort_mode="multi",
page_action="native",
row_selectable="multi",
selected_columns=[],
selected_rows=[],
page_current= 0,
page_size=20,
#page_count=50,
derived_virtual_selected_rows=None
),
I load the data dynamically using callbacks
:
@app.callback(
Output('datatable-testcaseinfo', 'data'),
[Input('datatable-testcaseinfo', "page_current"),
Input('datatable-testcaseinfo', "page_size")]
)
def update_table(page_current, page_size):
conn = self.connection()
df = pd.read_sql_query(f"SELECT * from testcaseinfo WHERE rowid >= {page_current*page_size} AND rowid <= {(page_current+1)*page_size}", \
conn)
return df.to_dict('records')
How can I set the maximum number of pages to enable the pagination?
I tried using page_count=50
but it doesnt work