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

If we have a single digit page number displayed, then we can't use backspace key for removing the page number to enter a new one. There cannot be a state where we have an empty page number box.

Open prakhar3agrwal opened this issue 9 years ago • 4 comments

The major problem here is that suppose we are at page 32 and we press backspace, then '2' is removed from '32' and page 3 is displayed. Now if we again press backspace then we are navigated to page '1' and '1' is displayed in the page number box. Now if we want to see page '9' then we will have to select '1' present in the page number box using shift key or using mouse and replace it with '9'. Backspace key is non-active here. Ideal way should be that if we press backspace then the page should not change and the page number box should become empty so that user can type any other page number.

Current functioning: initial

Expected functioning: expected

I have made the solution for it and will be submitting the pull request soon. Please review the issue.

prakhar3agrwal avatar Oct 29 '15 10:10 prakhar3agrwal

Hi @prakhar3agrwal ,

Were you able to submit PR.

I think this is being caused by the below code

if (!angular.isNumber(options.paginationCurrentPage) || options.paginationCurrentPage < 1) {
    options.paginationCurrentPage = 1;//this resets to pageno 1 but instead should be set to 0 or something else
}

This also causes another issue with ui grid were if you are on the second last page and change the pagination size it will reset to 1st page and not the current page.

Thanks, Anirudha

AnirudhaGohokar avatar May 16 '16 06:05 AnirudhaGohokar

Hi Anirudha,

No I was not able to submit PR, it's good that the issue is fixed. However it would be great if my PR is accepted so that I can fix issues in future.

Regards, Prakhar

On Mon, May 16, 2016 at 12:08 PM, Anirudha Gohokar <[email protected]

wrote:

Hi @prakhar3agrwal https://github.com/prakhar3agrwal ,

Were you able to submit PR.

Though I have fixed the issue by changing line no:21327 to this:

if (!angular.isNumber(options.paginationCurrentPage) || options.paginationCurrentPage < 1) { //options.paginationCurrentPage = 1; original code to reset page number if(options.paginationCurrentPage===undefined) options.paginationCurrentPage = undefined; else options.paginationCurrentPage = $scope.paginationApi.getTotalPages(); return; }

This also fixes another issue with ui grid were if you are on the second last page and change the pagination size it will reset to 1st page and not the current page.

Thanks, Anirudha

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/angular-ui/ui-grid/issues/4594#issuecomment-219359440

prakhar3agrwal avatar May 17 '16 04:05 prakhar3agrwal

@prakhar3agrwal apparently that didn't fix the issue..so have updated the comment to pinpoint the cause behind it. Will require some logical change and a lot of testing there.

AnirudhaGohokar avatar May 17 '16 06:05 AnirudhaGohokar

When any input is changed in the field, the grid automatically triggers the page changed event. I expect this is why the event listener added to the selected page field automatically puts 1 when empty. Could this behaviour of adding the input event to automatically trigger the page changed event be made configurable? Our users are happy to be given the time to fully change the page manually and only trigger the page changed event once 'Enter' is pressed. If the page number is 3 characters, using backspace 3 times triggers 3 page changed events which is not particularly useful so the option to disable this might help all persons interested in this ticket/

julie4754 avatar Jul 07 '22 11:07 julie4754