mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 01:15:43 +03:00
Add a resetPagination method to the searchable mixin
Searchable can be used without pagination, but reseting pagination is more a function of search than pagination insofar as if you add search to a page, you are also going to want automatic pagination resetting.
This commit is contained in:
@@ -36,6 +36,16 @@ export default Mixin.create({
|
||||
fuzzySearchEnabled: false,
|
||||
regexEnabled: true,
|
||||
|
||||
// Search should reset pagination. Not every instance of
|
||||
// search will be paired with pagination, but it's still
|
||||
// preferable to generalize this rather than risking it being
|
||||
// forgotten on a single page.
|
||||
resetPagination() {
|
||||
if (this.get('currentPage') != null) {
|
||||
this.set('currentPage', 1);
|
||||
}
|
||||
},
|
||||
|
||||
fuse: computed('listToSearch.[]', 'fuzzySearchProps.[]', function() {
|
||||
return new Fuse(this.get('listToSearch'), {
|
||||
shouldSort: true,
|
||||
|
||||
Reference in New Issue
Block a user