Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoResetPageIndex seems to be default true when manualPagination=true, is not expectd as docs saying #5611

Closed
2 tasks done
slow-groovin opened this issue Jun 19, 2024 · 1 comment

Comments

@slow-groovin
Copy link

TanStack Table version

v8.17.3

Framework/Library version

Vue v8.17.3

Describe the bug and the steps to reproduce it

codes

  1. table options
options.onPaginationChange = onUpdatePageState
options.rowCount = props.rowCount
  1. onPaginationChange
function onUpdatePageState(updater: Updater<PageState>) {
  const oldValue=_.clone(pagination.value)
  valueUpdater(updater, pagination)
  if(!_.isEqual(oldValue,pagination.value)){
    emits('onPaginationUpdate', pagination.value.pageIndex, pagination.value.pageSize)
  }
}
  1. emit call function
function paginationChangeQuery(i:number,n:number){
  console.log('call',i,n)
  // debugger
  data.value=dataAll.slice(i*n,i*n+n)
}
  1. change pageIndex action
<Button
            v-for="pageNumber in [1,2,3,4]"
            @click="props.table.setPageIndex(pageNumber- 1)"
          >

behavior

when setPageIndex, it will call onPaginationChange twice, the log is

call 3 10
call 0 10

first log is within expectations,
second log seems reset the pagination, and cause the manual pagination failed.
2. try set autoResetPageIndex:false , it will functioning properly

call 3 10

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

holdon

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@slow-groovin
Copy link
Author

caused by my negligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant