似乎使用pagination_settings参数将分页选项添加到DataTable类.
根据here给出的示例,我创建了一个带有分页的DataTable的工作演示,并使用下拉列表选择条目数:
import dash
from dash.dependencies import Input, Output
import dash_table
import dash_html_components as html
import dash_core_components as dcc
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')
df[' index'] = range(1, len(df) + 1)
app = dash.Dash(__name__)
PAGE_SIZE = 15
app.layout = html.Div([
html.Div('Data table pagination test'),
dcc.Dropdown(
id='select_page_size',
options=[{'label': '5', 'value': 5}, {'label': '10', 'value': 10}, {'label': '15', 'value': 15}],
value=5
),
ht