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

同时设置pageNumber和searchText初始值会冲突 #2580

Closed
aron10 opened this issue Aug 18, 2016 · 4 comments
Closed

同时设置pageNumber和searchText初始值会冲突 #2580

aron10 opened this issue Aug 18, 2016 · 4 comments
Labels
upgrade to latest version Issues that are fixed and need to upgrade to the latest version.

Comments

@aron10
Copy link

aron10 commented Aug 18, 2016

同时设置pageNumber和searchText初始值会有冲突,造成pageNumber值无效
$table.bootstrapTable({
url: "XXXX",
toolbar:'.toolbar',
showColumns: true,
striped: true,
pagination: true,
pageList: [20,30,50],
pageSize:20,
pageNumber:2,
sortOrder:'desc',
search:true,
searchText:"ja",
sidePagination:'server'
});

@dabros
Copy link
Contributor

dabros commented Aug 18, 2016

@wenzhixin

@jonatanklosko
Copy link
Contributor

I've just stumbled upon the same issue probably. When I use server pagination and I set both searchText and pageNumber, the 1st page is always rendered (pageNumber is reset to 1).
I can provide the chain of things leading to this:

  • inside the init function initSearchText is called (here)
  • inside the initSearchText function onSearch is called (here)
  • inside the onSearch function there's an if that could return but it evaluates to false (here)
  • below this if we finally set the pageNumber to 1 (here)

The problem seems to be in the fact that despite of the presence of this.options.searchText, the this.searchText is undefined, and thus the if fails.
I cannot say what solution fits the whole code, but I can say that adding this

this.searchText = this.options.searchText;

under this line works (the if evaluates to true at the first time).

@jfly
Copy link
Contributor

jfly commented Oct 4, 2016

Ping. Any update here? This is causing us some trouble. Is there anything wrong with @jonatanklosko's suggested workaround?

@wenzhixin wenzhixin added the upgrade to latest version Issues that are fixed and need to upgrade to the latest version. label Mar 10, 2019
@wenzhixin
Copy link
Owner

Fixed in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upgrade to latest version Issues that are fixed and need to upgrade to the latest version.
Projects
None yet
Development

No branches or pull requests

5 participants