reactjs - 反应引导表不改变 sizePerPageList
问题描述
我正在尝试修改我的 react-bootstrap-table2,但是它不符合我传入的选项之一。对于传入表组件的选项,这是我的 return 语句的一部分。到目前为止,这是一个有用的链接
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]
}
推荐阅读
- reactjs - 为什么“键”不传播到 {children} 元素映射中的反应元素?
- python - 如何在输出中获取 Escape char '\\\\'
- amazon-web-services - cloudformation 中的 YAML 格式错误。我该如何解决这个错误?
- ios - Mac nodeJS、Cordova、Ionic 从头开始安装指南
- python - 是否可以使用 input() 函数让用户输入对象的变量?
- c# - 如果在 asp.net 核心中异步日志记录失败,则调用一个操作
- google-sheets - 谷歌表出勤报告
- arrays - Julia:被映射的函数有多个输入参数的 mapslices()?
- java - JNI - 类加载问题。DefineClass 函数似乎不起作用
- java - 如何将警报音量设置为零?