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

Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize #482

Closed
loveDstyle opened this issue Oct 26, 2017 · 3 comments
Labels

Comments

@loveDstyle
Copy link

loveDstyle commented Oct 26, 2017

I'm submitting a...


[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Support request => Please do not submit support request here

Current behavior

Pagination 组件中,点选切换pageSize的时候会在发出nzPageSizeChange事件之间先发出一个nzPageIndexClickChange事件。

Expected behavior

点选切换pageSize的时候不再发出nzPageIndexClickChange事件

What is the motivation / use case for changing the behavior?

该bug导致导致在asyncTable中点选每页条目时行为异常;这是由于_buildIndexes方法中调用了_jumpPage方法造成的,而_jumpPage应该只由用户点击操作来调用


Angular version: ^4.0

ng-zorro-antd version: 0.5.5

Browser:
- [ x] Chrome (desktop) version 61.0
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX



@loveDstyle loveDstyle changed the title Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize type:bug Oct 26, 2017
@loveDstyle loveDstyle changed the title Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize type:bug Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize Label:type:bug Oct 26, 2017
@loveDstyle loveDstyle changed the title Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize Label:type:bug Unexpected nzPageIndexClickChange event got emitted by changing pagination's pageSize Oct 26, 2017
@vthinkxie
Copy link
Member

will be fixed in next version, thanks for your feedback.

@hsuanxyz
Copy link
Member

hsuanxyz commented Oct 27, 2017

@vthinkxie Can add a boolean parameter in the _jumpPage function?

_jumpPage(index, isClick = true) {
    ...
    if (isClick) {
         this.nzPageIndexClickChange.emit(this.nzPageIndex);
    }
  }

correct:

_buildIndexes() {
    this._lastIndex = Math.ceil(this._total / this._pageSize);
    if (this._current > this._lastIndex) {
      // - this._jumpPage(this._lastIndex);
      this.nzPageIndex = this._lastIndex;
      this.nzPageIndexChange.emit(this.nzPageIndex);
    }
   ...
  }

@lock
Copy link

lock bot commented Feb 18, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 18, 2019
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants