Angular-slickgrid Paginator的每页item没有按照配置的值显示
Angular-slickgrid Paginator's item per page is not displayed according to configured values
我正在使用 angular-slickgrid:“^2.17.11”。我对它很陌生。以下是我如何配置网格选项以显示每页的分页和项目。在配置中我将页面大小设置为 [5, 10, 15, 20, 25, 50, 75] 但在 UI 中它是 [5, 10, 15, 20, 25, 50, 75, 75, 100]。不知道它是怎么发生的。我错过了什么吗?
{
enableSorting: true,
enableFiltering: true,
enablePagination: true,
pagination: {
pageSizes: [5, 10, 15, 20, 25, 50, 75],
pageSize: 5
},
autoResize: {
containerId: 'tableSection_details',
sidePadding: 5
},
alwaysShowVerticalScroll: false,
excelExportOptions: {
filename: "DoC",
sheetName: this._exportSheetName
},
enableExcelExport: true,
gridMenu: {
onCommand: (e, args) => {
if (args.command === 'toggle-preheader') {
// in addition to the grid menu pre-header toggling (internally), we will also clear grouping
this.clearGrouping();
}
},
},
enableDraggableGrouping: true,
createPreHeaderPanel: true,
showPreHeaderPanel: true,
preHeaderPanelHeight: 40,
draggableGrouping: {
dropPlaceHolderText: 'Drop column header here to group by the column',
deleteIconCssClass: 'fa fa-times',
onGroupChanged: (e, args) => this.onGroupChanged(args),
onExtensionRegistered: (extension) => this.draggableGroupingPlugin = extension,
}
}
请注意,我是 Angular-Slickgrid 的作者。
那是 Angular-Slickgrid 库中的错误,已在 PR. A new version is however pending for another week or so. (It's now fixed and released, see version)
中修复
代码现在将在内部检查用户是否提供了自定义页面大小,如果是,将使用它们,否则它将使用全局网格选项(默认为 [5, 10, 15, 20, 25, 50, 75, 100]
)中定义的页面大小。
代码修复
// using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
// jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
if (gridOptions.enablePagination && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
}
编辑
这已在新 Angular-Slickgrid new version
下修复并可用
我正在使用 angular-slickgrid:“^2.17.11”。我对它很陌生。以下是我如何配置网格选项以显示每页的分页和项目。在配置中我将页面大小设置为 [5, 10, 15, 20, 25, 50, 75] 但在 UI 中它是 [5, 10, 15, 20, 25, 50, 75, 75, 100]。不知道它是怎么发生的。我错过了什么吗?
{
enableSorting: true,
enableFiltering: true,
enablePagination: true,
pagination: {
pageSizes: [5, 10, 15, 20, 25, 50, 75],
pageSize: 5
},
autoResize: {
containerId: 'tableSection_details',
sidePadding: 5
},
alwaysShowVerticalScroll: false,
excelExportOptions: {
filename: "DoC",
sheetName: this._exportSheetName
},
enableExcelExport: true,
gridMenu: {
onCommand: (e, args) => {
if (args.command === 'toggle-preheader') {
// in addition to the grid menu pre-header toggling (internally), we will also clear grouping
this.clearGrouping();
}
},
},
enableDraggableGrouping: true,
createPreHeaderPanel: true,
showPreHeaderPanel: true,
preHeaderPanelHeight: 40,
draggableGrouping: {
dropPlaceHolderText: 'Drop column header here to group by the column',
deleteIconCssClass: 'fa fa-times',
onGroupChanged: (e, args) => this.onGroupChanged(args),
onExtensionRegistered: (extension) => this.draggableGroupingPlugin = extension,
}
}
请注意,我是 Angular-Slickgrid 的作者。
那是 Angular-Slickgrid 库中的错误,已在 PR. A new version is however pending for another week or so. (It's now fixed and released, see version)
中修复代码现在将在内部检查用户是否提供了自定义页面大小,如果是,将使用它们,否则它将使用全局网格选项(默认为 [5, 10, 15, 20, 25, 50, 75, 100]
)中定义的页面大小。
代码修复
// using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
// jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
if (gridOptions.enablePagination && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
}
编辑
这已在新 Angular-Slickgrid new version
下修复并可用