我正在尝试修改我的react-bootstrap-table2,但是它不符合我传入的选项之一。这是返回到表组件中的选项的return语句的一部分。这是迄今为止有用的link
return {
options: {
bootstrap4: true,
bordered: false,
displayCaret: true,
striped: true,
showFilters: true,
keyName: "key",
keyField: "key",
showColumnBorders: false,
showPagination: true,
sizePerPageList: [ 5, 10, 20 ],
defaultSorted: [
{
dataField: "name",
order: "asc"
}
]
},
我正在清楚地设置sizePerPageList,但它不会在UI中更改它。它只显示了10、25、30和50的下拉列表,而不是5、10和20。我这样做的方式有误吗?
这是我的实现方式:
<SchemaTable
options={SchemaSettings.options}
schema={mySchema}
data={mappedData}
className="disable-hot-table-cells"
/>
SchemaSettings.options是要检索的选项列表。
解决方案是我需要将其虹吸到它自己的对象中:
options: {
bootstrap4: true,
bordered: false,
displayCaret: true,
striped: true,
showFilters: true,
keyName: "key",
keyField: "key",
showColumnBorders: false,
showPagination: true,
defaultSorted: [
{
dataField: "name",
order: "asc"
}
],
paginationOptions: {
sizePerPage: 20,
page: 1,
alwaysShowAllBtns: true,
hideSizePerPage: false,
sizePerPageList: [5,10,20]
}