1
0
Fork 0

front-end: added LIKE filter, issue: #1657

This commit is contained in:
hkernbach 2016-02-09 09:42:12 +01:00
parent 0e3ec4fa6a
commit 176bb36b15
2 changed files with 31 additions and 18 deletions

View File

@ -64,27 +64,39 @@
}
var query = " FILTER", res = '',
parts = _.map(this.filters, function(f, i) {
if (f.op === 'IN' || f.op === 'NOT IN') {
res = ' ';
if (f.op === 'LIKE') {
res = " " + f.op + "(x.`" + f.attr + "`, @param";
res += i;
res += ")";
}
else {
res = " x.`";
if (f.op === 'IN' || f.op === 'NOT IN') {
res = ' ';
}
else {
res = " x.`";
}
res += f.attr;
if (f.op === 'IN' || f.op === 'NOT IN') {
res += " ";
}
else {
res += "` ";
}
res += f.op;
if (f.op === 'IN' || f.op === 'NOT IN') {
res += " x.@param";
}
else {
res += " @param";
}
res += i;
}
res += f.attr;
if (f.op === 'IN' || f.op === 'NOT IN') {
res += " ";
}
else {
res += "` ";
}
res += f.op;
if (f.op === 'IN' || f.op === 'NOT IN') {
res += " x.@param";
}
else {
res += " @param";
}
res += i;
bindVars["param" + i] = f.val;
return res;
});

View File

@ -70,6 +70,7 @@
<option value="&lt;=">&lt;=</option>
<option value="&gt;">&gt;</option>
<option value="&gt;=">&gt;=</option>
<option value="LIKE">LIKE</option>
<option value="IN">IN</option>
<option value="NOT IN">NOT IN</option>
</select><input id="attribute_value0" type="text" placeholder="Attribute value" class="filterValue">