Hi,
We are using kendo grid for Angular and displaying the results based on some input criteria (input some fields in the form and click on button to fetch results and display in grid). For the first time grid displays the first page.
If we change the search criteria and fetches the results, the grid still displays the previous page index and not reset to first page.
EX: We set the pageSize as 10. In the first search request we get 100 records. So displayed 10 pages. I select 8'th page
In the second search request we get only 40 records displaying 4 pages. But no data is displayed in the grid unless we click on any of the 4 paging buttons as it is still considering the page index as 8.
How can we reset page index to first page with every new request that is fetching new data. We are using "kendoGridBinding" to bind the data to the grid
<kendo-grid [style.height.%]="100" #grid
[kendoGridBinding]="gridData"
[pageSize]="10"
[pageable]="true"
<ng-template kendoPagerTemplate let-totalPages="totalPages" let-currentPage="currentPage">
<kendo-pager-prev-buttons></kendo-pager-prev-buttons>
<kendo-pager-numeric-buttons [buttonCount]="10"></kendo-pager-numeric-buttons>
<kendo-pager-next-buttons></kendo-pager-next-buttons>
<kendo-pager-info></kendo-pager-info>
<kendo-pager-page-sizes [pageSizes]="[10, 50, 100, 200]"></kendo-pager-page-sizes>
</ng-template>
</kendo-grid>
Thanks in advance,
Rajesh
The kendoGridBinding directive is used to handle internally the (dataStateChange) event of the grid and we can use it only with the default filtering, sorting, grouping, and paging data operations as demonstrated in the following article:
https://www.telerik.com/kendo-angular-ui/components/grid/data-binding/automatic-operations/#toc-built-in-directive.
If we want to implement custom filtering we will need to create the required CompositeFilterDescriptor that can contain multiple FilterDescriptors and manually process the data (once we click the button to fetch the filtered results) using the built in process method.
I hope this helps. Let me know in case further assistance is required for this case.
Regards,
Svetlin
Progress Telerik
Thanks for the response.
I don't know whether my last post is clear to you. Sorry if it was not clear
To be clear i am listing the steps below
1) I have a dropdown with few values. I will select one value from the dropdown and click on a button. Then i will query my database based on the dropdown value and populates the grid with the results fetched from database
Assume that i got 100 records displaying 10 pages (pageSize=10). I selected 8'th page and i could see the records in page 8. This workflow is fine
2)Now i select a different value from the dropdown and click on the button again. Now again i will query my database based on the dropdown value and fetches the records and bind to grid. (Please remember that i did the second step when i was in page 8)
Assume that i got only 40 records in the second step displaying 4 pages. But my grid does not show the data unless i click on any of 4 paging buttons as it is still considering the page index as 8. (4 paging buttons are displayed after fetching the results but none of them selected and no data is displayed)
I query a third party service that will give me all the relevant records for the dropdown value when i click on the button
I hope i am clear.
Do you have any example for this to display the first page automatically after performing the second step.
Thanks,
Rajesh