Skip to content

Commit

Permalink
Page validation added (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABorovaya authored and nekufa committed Dec 1, 2019
1 parent 87aa2bf commit 522e1d3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion public/admin/js/Space/toolbar/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ Ext.define('Admin.Space.toolbar.Collection', {
listeners: {
buffer: 500,
keyup(field) {
this.up('grid').store.loadPage(field.value || 1);
var store = this.up('grid').store;
var pageCount = Math.ceil(store.getTotalCount() / store.pageSize);
if(field.value <= pageCount && field.value >= 0) {
this.up('grid').store.loadPage(field.value || 1);
} else if(field.value > pageCount) {
this.up('grid').store.loadPage(pageCount);
} else if(field.value < 0) {
this.up('grid').store.loadPage(1);
}
}
}
}, {
Expand Down

0 comments on commit 522e1d3

Please sign in to comment.