ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

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

Open bielmenezes opened this issue 11 years ago • 5 comments

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)?

bielmenezes avatar Apr 28 '15 22:04 bielmenezes

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

PaulL1 avatar Apr 29 '15 21:04 PaulL1

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.

bielmenezes avatar Apr 30 '15 14:04 bielmenezes

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.

PaulL1 avatar May 27 '15 05:05 PaulL1

Plunker would be helpful.

sumeetsonawane11 avatar Oct 26 '17 14:10 sumeetsonawane11

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; }

krunal90 avatar Jan 13 '18 00:01 krunal90