Skip to content

Commit

Permalink
Table Pagination: Humans don't start counting at 0 (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: hfhbd <[email protected]>
  • Loading branch information
hfhbd and hfhbd authored Aug 18, 2021
1 parent b122b63 commit 751945f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private fun CalcPagination.custom(): PageControl<Int> = { pages, currentPage, go
goTo(previousIndex)
}

Button(title = "${currentPage.index}", disabled = true, size = ButtonSize.Small) { }
Button(title = "${currentPage.index + 1}", disabled = true, size = ButtonSize.Small) { }

Button(title = ">", size = ButtonSize.Small) {
val nextIndex = currentPage.index + 1
Expand Down
4 changes: 2 additions & 2 deletions src/jsMain/kotlin/app/softwork/bootstrapcompose/Table.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ public object Table {

for (index in buttons) {
if (index == currentPage.index) {
Button(title = "$index", disabled = true, size = ButtonSize.Small) { }
Button(title = "${index + 1}", disabled = true, size = ButtonSize.Small) { }
} else {
Button(title = "$index", size = ButtonSize.Small) {
Button(title = "${index + 1}", size = ButtonSize.Small) {
if (index < currentPage.index) {
actionNavigateBack?.invoke(currentPage, pages[index])
goTo(index)
Expand Down

0 comments on commit 751945f

Please sign in to comment.