Hello,
We have implemented syncfusion pagination table with filters in a React application. Functionality includes when a filter is selected, the syncfusion table reloads with new items, filters can also be unchecked or reset and the syncfusion table automatically reloads with all items.
One issue we noticed is, when users click on the filter with no associated items, the table shows no item as expected. However, when users uncheck or reset the filters, the syncfusion table reloads with expected items but always navigates to the last page. The expected behavior is navigating to the first page instead.
We have confirmed on our end, pageSettings property on syncfusion grid is not stateful and only be passed in on table initial load. That being said, on filter selection or reset, there is no update on pageSettings on our end.
Hi Celia,
Thanks for contacting Syncfusion support.
We are unable to understand the reported problem from
our side. So, kindly share the below details to provide a better solution.
Regards,
Rajapandiyan S
Hi Rajapandiyan,
Thank you for reaching out, we have attached a gif demo and detailed explanation is included as follows.
The attached gif shows a syncfusion table with a few filtering support, functionalities include:
Attachment: syncfusion_9c7d89d3.7z
Hi Celia,
Thanks
for sharing the details.
By analyzing the Gif file we found that you are performing the filter operation
externally using a custom component. We would like to know the actions behind the
checkbox (placed outside of the Grid) change.
Regards,
Rajapandiyan S
Hi Rajapandiyan,
Hi Celia,
Thanks
for sharing the details.
We have prepared a simple sample based on your requirement (“dynamically
update the Grid dataSource on checkbox change event”) and tried to
replicate the reported problem. But it was unsuccessful from our side. The Grid
Component is loaded properly with the previous pageSettings. Find the below
sample for your reference,
Sample: https://stackblitz.com/edit/react-xa25ij-uti2iu?file=component%2Fapp.jsx
Kindly try to replicate the issue in the provided sample or share the issue sample which will be very helpful for us.
Regards,
Rajapandiyan S
Hi Rajapandiyan,
Thank you for providing the sandbox environment, I have tried to reproduce the issue with the sandbox and I have a few questions which will help troubleshooting:
Hi Celia,
Thanks
for sharing the details.
Query #1: I have noticed that whenever checking/unchecking a filter
checkbox, the table stays in the same page.
Yes, The Grid will always maintain the previous settings (pageSettings,
filterSettings, sortSettings, etc.,) when it is refreshed. This is the default
behavior of Grid. If you want to move the Grid to first page when changing the
dataSource, you can use goToPage method.
goToPage: https://ej2.syncfusion.com/react/documentation/api/grid/#gotopage
|
var data1 = orderData.slice(50, 100); setGridData(data1); grid.goToPage(1); // navigate to first page break;
|
Query #2: It seems the issue can be specific to using remote data on the
grid
We have updated the data after the api call and are unable to replicate the issue
from our side. Find the sample for your reference.
Sample: https://stackblitz.com/edit/react-xa25ij-qcqobx?file=component%2Fapp.jsx
Kindly share the complete code file. If possible, share the issue reproducible sample, which will be very helpful to resolve it earlier.
Regards,
Rajapandiyan S