Permalink
Browse files

fix(datatable): reset page on search

fixes empty table on search if result is less pages than before

resolves #50
  • Loading branch information...
natrim committed Jun 19, 2017
1 parent 18a5219 commit 2a6db1d17cb9fc499a016af500dc0130fc19681c
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/datatable.js
@@ -1,3 +1,4 @@
import {PLATFORM} from 'aurelia-pal';
import {inject} from 'aurelia-dependency-injection';
import {bindingMode, computedFrom} from 'aurelia-binding';
import {bindable, customElement} from 'aurelia-templating';
@@ -254,9 +255,18 @@ export class DataTable {
return;
}
this.pager.reloadCount();
// reset page without trigerring unnecessary load
this.ready = false;
this.page = 1;
this.load();
// wait for next tick to load data
PLATFORM.global.setTimeout(() => {
this.ready = true;
this.pager.reloadCount();
this.load();
}, 1);
}
reload() {

0 comments on commit 2a6db1d

Please sign in to comment.