Commit 5900bca4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update HistoryGridFilter to fix bugs in filterGetValue.

parent 345c3600
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
'is equal to': 'égal à', 'is equal to': 'égal à',
'Is Over': 'Is Over', 'Is Over': 'Is Over',
'Javascript API': 'Javascript API', 'Javascript API': 'Javascript API',
'key': 'clé', 'key': 'clef',
'Labels': 'Etiquettes', 'Labels': 'Etiquettes',
'Last Name': 'Nom de famille', 'Last Name': 'Nom de famille',
'Last name': 'Nom de famille', 'Last name': 'Nom de famille',
......
...@@ -112,7 +112,7 @@ Ext.define('TrackEvents.grid.HistoryFilter', { ...@@ -112,7 +112,7 @@ Ext.define('TrackEvents.grid.HistoryFilter', {
/** /**
* Build the value to be used by the filter. * Build the value to be used by the filter.
* Superseede the method of the base class to handle the data filter * Supersede the method of the base class to handle the data filter
* which is based on the Dbui.form.field.Table widget. * which is based on the Dbui.form.field.Table widget.
* *
* @param {Ext.form.Field} field * @param {Ext.form.Field} field
...@@ -137,18 +137,37 @@ Ext.define('TrackEvents.grid.HistoryFilter', { ...@@ -137,18 +137,37 @@ Ext.define('TrackEvents.grid.HistoryFilter', {
var s; var s;
if (row.lentgh === 1) { if (Ext.isEmpty(row[0])) {
s = '"' + row[0] +'"';
if (Ext.isEmpty(row[1])) {
return;
// filter on value
} else {
s = toJSON(row[1]);
}
} else { } else {
s = '"' + row[0] +'": ' + toJSON(row[1]);
// filter on key
if (Ext.isEmpty(row[1])) {
s = '"' + row[0] +'"';
// filter on key and value
} else {
s = '"' + row[0] +'": ' + toJSON(row[1]);
}
} }
value += (value.length > 0 ? '%' + s : s); value += (value.length > 0 ? '%' + s : s);
}); });
// the database is filtered by the LIKE operator, add joker % // the database is filtered by the LIKE operator, add joker %
value = (value[0] === "%" ? value : "%" + value); if (!Ext.isEmpty(value)) {
value = (value[value.length-1] === "%" ? value : value + "%"); value = (value[0] === "%" ? value : "%" + value);
value = (value[value.length-1] === "%" ? value : value + "%");
}
return value; return value;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment