Permalink
Browse files

fix(resource): set resource based on binding

  • Loading branch information...
VMBindraban
VMBindraban committed Jun 28, 2016
1 parent 60a19a8 commit 89b2667e71a572646af8202f26ba85b4c7d71ba3
Showing with 12 additions and 10 deletions.
  1. +12 −10 src/datatable.js
@@ -25,20 +25,22 @@ export class DataTable {
@bindable populate = false; // Which columns to populate. True for all, string for specific.
@bindable select; // User provided callback, called upon clicking on a row.
@bindable repository;
@bindable resource;
@bindable data;
@bindable route;
@bindable pages;
constructor(Router, element, entityManager) {
this.router = Router;
this.element = element;
if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = entityManager.getRepository(this.element.getAttribute('resource'));
}
this.router = Router;
this.element = element;
this.entityManager = entityManager;
}
attached() {
if (!this.repository && this.resource) {
this.repository = this.entityManager.getRepository(this.resource);
}
this.ready = true;
this.criteria.where = this.where;
this.criteria.sort = this.criteria.sort || {};
@@ -115,8 +117,8 @@ export class DataTable {
searchColumnChanged(newValue, oldValue) {
if (!this.ready) {
return;
}
}
delete this.criteria.where[oldValue];
return this.doSearch();
@@ -125,8 +127,8 @@ export class DataTable {
doSearch() {
if (!this.ready) {
return;
}
}
if (typeof this.criteria.where[this.searchColumn] === 'object') {
this.criteria.where[this.searchColumn].contains = this.search;
} else {

0 comments on commit 89b2667

Please sign in to comment.