Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(criteria): check for invalid attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
VMBindraban committed Oct 18, 2016
1 parent 5941901 commit 941f11b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export class Filter extends CriteriaBuilder {

// Do we need to set pre-defined values for the filter?
if (this.criteria.where && Object.keys(this.criteria.where).length) {
return this.parseCriteria(this.criteria.where);
this.parseCriteria(this.criteria.where);

if (this.filters.length > 0) {
return;
}
}

this.valueElement.type = this.columns[0].type || 'string'; // set the initial valueElement `type`
Expand Down Expand Up @@ -124,6 +128,16 @@ export class Filter extends CriteriaBuilder {
}

create(blockIndex, data) {
if (data && data.field) {
let options = this.fieldElement.options.map(option => {
return option.name;
});

if (options.indexOf(data.field) < 0) {
return;
}
}

let filter = {
field : this.fieldElement,
operator: this.operatorElement,
Expand Down

0 comments on commit 941f11b

Please sign in to comment.