Reset current page when changing page size

This commit is contained in:
Michael Lange 2020-03-30 21:20:58 -07:00
parent 3d02f61455
commit 8dc54a6164
3 changed files with 8 additions and 4 deletions

View File

@ -2,9 +2,10 @@ import Component from '@ember/component';
import { inject as service } from '@ember/service';
export default Component.extend({
tagName: '',
userSettings: service(),
tagName: '',
pageSizeOptions: Object.freeze([10, 25, 50]),
onChange() {},
});

View File

@ -5,7 +5,10 @@
class="field-body"
@options={{pageSizeOptions}}
@selected={{userSettings.pageSize}}
@onChange={{action (mut userSettings.pageSize)}} as |option|>
@onChange={{action (queue
(action (mut userSettings.pageSize))
(action onChange)
)}} as |option|>
{{option}}
</PowerSelect>
</div>

View File

@ -93,7 +93,7 @@
{{/t.body}}
{{/list-table}}
<div class="table-foot">
{{page-size-select}}
{{page-size-select onChange=(action resetPagination)}}
<nav class="pagination">
<div class="pagination-numbers">
{{p.startsAt}}&ndash;{{p.endsAt}} of {{sortedJobs.length}}