Skip to content

Commit 68751c1

Browse files
committed
adding a page size dropdown to the paging control
1 parent 3680510 commit 68751c1

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bower_components/
2+
node_modules/

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"iron-flex-layout": "PolymerElements/iron-flex-layout#^2.0.0",
2222
"paper-icon-button": "PolymerElements/paper-icon-button#^2.0.1",
2323
"paper-input": "PolymerElements/paper-input#^2.0.2",
24-
"iron-icons": "PolymerElements/iron-icons#^2.0.1"
24+
"iron-icons": "PolymerElements/iron-icons#^2.0.1",
25+
"juicy-select": "^1.1.3"
2526
},
2627
"devDependencies": {
2728
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^2.0.0",

pagination-input.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
55
<link rel="import" href="../paper-input/paper-input.html">
66
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
7+
<link rel="import" href="../juicy-select/juicy-select.html">
78

89
<!--
910
`pagination-input` is a simple pagination control with an paper-input.
@@ -66,6 +67,8 @@
6667
}
6768
</style>
6869

70+
<juicy-select value="{{pageSize}}" options="[[pageSizes]]" text-property="Name" value-property="Value" selected-property="Selected">
71+
</juicy-select>
6972
<paper-icon-button icon="icons:first-page" on-click="_onFirstPageBtnClick" disabled$="[[_shouldDisablePreviousPageBtns(currentPage)]]"></paper-icon-button>
7073
<paper-icon-button icon="icons:chevron-left" on-click="_onPreviousPageBtnClick" disabled$="[[_shouldDisablePreviousPageBtns(currentPage)]]"></paper-icon-button>
7174
<paper-input id="input" type="number" on-change="_onInputValueChange" no-label-float="true" min="1" max$="[[pageCount]]" auto-validate allowed-pattern="[0-9]">
@@ -93,17 +96,31 @@
9396
/**
9497
* Number of pages
9598
*/
96-
pageCount: Number
99+
pageCount: Number,
100+
pageSize: {
101+
type: Number,
102+
notify: true
103+
},
104+
pageSizes: {
105+
type: Array
106+
},
97107
}
98108
}
99109

100110
static get observers() {
101111
return [
102112
"_onPageCountChange(pageCount)",
103-
"_onCurrentPageChange(currentPage)"
113+
"_onCurrentPageChange(currentPage)",
114+
"_onSizeChange(pageSize)",
104115
];
105116
}
106117

118+
_onSizeChange(e) {
119+
if (e) {
120+
this.dispatchEvent(new CustomEvent('sizeChange', { detail: { size: e } }));
121+
}
122+
}
123+
107124
_shouldDisablePreviousPageBtns(currentPage) {
108125
return currentPage === 1;
109126
}

0 commit comments

Comments
 (0)