Posted 10 November 2019, 9:16 pm EST
How we can display grid data count out of all data in wijmo flex grid…?
Like: Items 1 to 10 of 25 - (1 to 10 is no of records in current pagination, 25 is the total records in the grid).
Forums Home / Wijmo / General Discussion
Posted by: rajesh.sakhamuri on 10 November 2019, 9:16 pm EST
Posted 10 November 2019, 9:16 pm EST
How we can display grid data count out of all data in wijmo flex grid…?
Like: Items 1 to 10 of 25 - (1 to 10 is no of records in current pagination, 25 is the total records in the grid).
Posted 11 November 2019, 10:19 pm EST
Hi Team,
Any update on this issue…?
Posted 12 November 2019, 6:04 pm EST
Hi Rajesh,
You can handle the pageChanged event of the CollectionView class and calculate the start and end index of the current page:
new wjcCore.CollectionView(data, {
pageChanged: function(s, e) {
let st = s.pageSize * (s.pageIndex)
let ed = (st + s.pageSize - 1);
if(ed >= s.totalItemCount) {
ed -= (ed % s.totalItemCount) + 1;
}
self.startIndex = st, self.endIndex = ed;
},
pageSize: 13,
});
You will also need to initialize the startIndex and endIndex for the first time:
this.source = this.getData(336);
this.startIndex = 0;
this.endIndex = this.source.pageSize - 1;
You may refer to the sample link below:
https://stackblitz.com/edit/angular-svwcyd
Regards,
Ashwin
Posted 19 November 2019, 9:12 pm EST
Hi Ashwin,
The above solution is working for fixed grid size(13 records in each page). Actually my scenario is, i have to change my grid size like 13, 25 100 etc,. Then it’s need to display corresponding results like : ’ 1 to 21 of 25’.
And if there is no data in grid need to display : ’ No data available’.
Can you please tell the solution, if you know…
Thanks in advance.!
Posted 20 November 2019, 3:36 pm EST
Hi Rajesh,
The provided solution will also work when the page size is updated but you will need to update the page data manually when the pageSize is changed. Please refer to the updated sample below:
https://stackblitz.com/edit/angular-vxb3cm
In this sample, I have updated the page data when the selectedIndex of the ComboBox changes.
~regards