angular-ui / ui-grid

UI Grid: an Angular Data Grid
http://ui-grid.info
MIT License
5.39k stars 2.47k forks source link

Page number is not updated when the server search is called outside the paginator #3377

Closed bielmenezes closed 9 years ago

bielmenezes commented 9 years ago

Hello guys,

I am using UI-GRID with external pagination and a external search form that have some filters that I can apply in the data (on server side)

My issue is when I execute the first time the search, change the page in the grid pagination component to page 2, and execute the search again via form submit's button. The page number on pagination component is not reseted to 1 (keep as page 2).

How can I handle this situation? There is any way to set the page number via API without recall my search method on server (like the seek() method does)?

PaulL1 commented 9 years ago

I believe you can set the current page directly in code, I think it is stored in gridOptions, but you'd need to check the pagination code. grid.options.paginationCurrentPage and https://github.com/angular-ui/ng-grid/blob/master/src/features/pagination/js/pagination.js, also http://ui-grid.info/docs/#/api/ui.grid.pagination.api:GridOptions

bielmenezes commented 9 years ago

Hello @PaulL1 ,

In fact, I can set the page number directly in code as you have shown, but if I do it in that way, it seems that the paginationCurrentPage is dispatching the event 'paginationChanged', what is not the correct behavior in my point of view. What I need is just 'inform' the paginator the number of the current page, nothing else.

Regards.

PaulL1 commented 9 years ago

Solution provided that should resolve the issue. This does fire an additional event, but that event could be ignored by the user through using a debounce. Closing.

sumeetsonawane11 commented 6 years ago

Plunker would be helpful.

krunal90 commented 6 years ago

Set the 'current-page' value equal to offset value in the function of the main search button. E.g. current-page="currentResultsPage" $scope.search = (offset = 1, searchValue){ $scope.currentResultsPage = offset; }