Hi Yashwanth,
Thanks for contacting Syncfusion support.
From your update, it seems that you are trying to set the totalRecordsCount
more than the actual records, fetch the current page data from a service, and
set that data to the Grid dataSource property. To work the Grid paging properly,
we need to bind the Grid dataSource which should be matched with the total records
count. In your sample, we suspect that, while clicking the 2nd page,
only the 2nd page records are set as the entire Grid dataSource. So,
the Grid will have only one page records. For example, if the page Size is 12
then the grid will have only 12 records which will be considered the first page
records. Due to this the Grid will navigate to the first page which is the default
behavior.
We understand that you want to load only the current page data from
the server, not the entire data. To achieve your requirement, we have options
like Load on demand using our Adaptors or Custom Data binding. Using these we could
send a request to the server to fetch the required page data and the total
count. So, the page links will be rendered based on the count and while clicking
the link, the next set of data will be fetched from the server and displayed in
the Grid. Please refer to the below documentation link for more information.
Documentation: https://ej2.syncfusion.com/angular/documentation/grid/data-binding/remote-data/
https://ej2.syncfusion.com/angular/documentation/grid/observables/#observables
https://ej2.syncfusion.com/angular/documentation/grid/observables/#handling-grid-actions
demo : https://ej2.syncfusion.com/angular/demos/#/material/grid/remote-data
https://ej2.syncfusion.com/angular/demos/#/material/grid/async-pipe
If this still doesn’t meet your requirement, please share the below
details that will be helpful for us to provide a better solution as early as
possible.
- Why
do you want to change the Grid dataSource inside the beforeDataBound
event?
- What
are the issues you are facing with the above remote/custom data bindings?
- Share
the initial Grid dataSource value
Regards,
Pavithra S