Knockout-Contrib / Knockout-Contrib/KoGrid
Issue when the next button is clicked after the page number is typed
- Dominant language
- JavaScript
- Stars
- 277
- Forks
- 124
- PR merge metrics
- No merged PRs in 30d
Description
This bug occurs when we type the number of the page in the pagination control. Just after that, if we click on the next page button, the number of the page is handled as a string and the +1 sum is done in a wrong way. For example, if we type 5 on the page number textbox, clicking on the next page button will take us to the 51th page, not the 6th.
I've recorded the behavior and we can see it in the image below.

One way we've found to deal with this problem is changing the code below, converting the value of the "page" variable to number, using the parseInt function.
`self.pageForward = function () {
var page = self.config.pagingOptions.currentPage();
self.config.pagingOptions.currentPage(Math.min(parseInt(page) + 1, self.maxPages()));
};`
I'm using Chrome version 62.0.3202.75.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the pagination control's pageForward entry point, where currentPage is read and the next page is selected. Reproduce the issue by typing 5 and clicking Next, then verify that the control selects page 6 rather than page 51.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100