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 on element value, not on (alias) name
Browse files Browse the repository at this point in the history
  • Loading branch information
VMBindraban committed Dec 6, 2016
1 parent c488d89 commit c169663
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class Filter extends CriteriaBuilder {

Object.keys(criteriaWhere).forEach((field, i) => {
data = Object.assign(this.buildFieldData(criteriaWhere[field]), {field: field});

if (i === 0) {
// create the first block
return this.create(undefined, data);
Expand Down Expand Up @@ -133,7 +134,7 @@ export class Filter extends CriteriaBuilder {
create(blockIndex, data) {
// prevent adding a non-existing field to the filter (leads to selecting the wrong field in the dropdown)
if (data && data.field) {
let options = this.fieldElement.options.map(option => option.name);
let options = this.fieldElement.options.map(option => option.value);

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

0 comments on commit c169663

Please sign in to comment.