我在Angular项目中使用Syncfusion。当任何分页事件发生更改时,我必须获取网格的当前页面和页面大小。我有以下代码:
component.html:
<ejs-grid #Grid class="data-grid" (recordDoubleClick)="onDoubleClick($event)" height="55vh" [dataSource]='dataSource'
[allowPaging]="true" [allowResizing]="true" [allowSorting]="true" [allowFiltering]="true"
[pageSettings]='pageSettings' (actionBegin)="onActionBegin($event)">
. . . .
. . . .
</ejs-grid>
组件.ts:
//For paging
@ViewChild("Grid")
public grid!:GridComponent;
currentPage: number = 1;
pageSize: number = 50;
onActionBegin(e: any) {
this.currentPage = this.grid.pagerModule.pagerObj.currentPage;
this.pageSize = this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value
console.log(this.pageSize)
}
问题是dropDownListObject
显示错误并显示:
属性"dropDownListObject"是私有的,只能在类"PagerDropDown"中访问。
如何解决此问题?
(相关链接(
我使用以下代码解决了这个问题:
this.pageSize = this.grid.pagerModule.pagerObj.pageSize