From d5ed52d4bbf4c82108de58d594b13af9a02f9167 Mon Sep 17 00:00:00 2001 From: hkernbach Date: Fri, 21 Oct 2016 11:58:58 +0200 Subject: [PATCH] ui filter bugfix --- .../js/collections/arangoDocuments.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocuments.js b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocuments.js index b9f6f378b3..f8e29b56e0 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocuments.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/collections/arangoDocuments.js @@ -68,27 +68,27 @@ if (this.filters.length === 0) { return ''; } - var query = ' FILTER'; - var res = ''; + var query = ' FILTER '; var parts = _.map(this.filters, function (f, i) { + var res = ''; + res += 'x.@attr '; + res += f.op; + res += ' @param'; + res += i; + if (f.op === 'LIKE') { - res = ' ' + f.op + '(x.@attr, @param'; - res += i; - res += ')'; - } else { - res += ' x.@attr '; - - res += f.op; - - if (f.op === 'IN' || f.op === 'NOT IN') { - res += ' x.@param'; + bindVars['param' + i] = '%' + f.val + '%'; + } else if (f.op === 'IN' || f.op === 'NOT IN ') { + if (f.val.indexOf(',') !== -1) { + bindVars['param' + i] = f.val.split(','); } else { - res += ' @param'; + var arr = []; + bindVars['param' + i] = arr.push(f.val); } - res += i; + } else { + bindVars['param' + i] = f.val; } - bindVars['param' + i] = f.val; if (f.attr.indexOf('.') !== -1) { bindVars['attr'] = f.attr.split('.'); } else { @@ -97,7 +97,7 @@ return res; }); - return query + parts.join(' &&'); + return query + parts.join(' && '); }, setPagesize: function (size) {