Commit a088b943 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed filterBooleans and language

parent 2272e695
...@@ -105,7 +105,7 @@ GenesysFilter = { ...@@ -105,7 +105,7 @@ GenesysFilter = {
var inputId = "#" + key + "_input"; var inputId = "#" + key + "_input";
var value = $(element).parent().find(inputId).val(); var value = $(element).parent().find(inputId).val();
if (GenesysFilterUtil.existInJson(value, key, jsonData)) { if (! GenesysFilterUtil.existInJson(value, key, jsonData)) {
GenesysFilterUtil.appendHtml(key, value, element); GenesysFilterUtil.appendHtml(key, value, element);
jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData); jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData);
$(inputId).val(''); $(inputId).val('');
...@@ -179,7 +179,7 @@ GenesysFilter = { ...@@ -179,7 +179,7 @@ GenesysFilter = {
var checked = $(element).parent().find(inputId).is(":checked"); var checked = $(element).parent().find(inputId).is(":checked");
if (checked && GenesysFilterUtil.existInJson(value, key, jsonData)) { if (checked && ! GenesysFilterUtil.existInJson(value, key, jsonData)) {
jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData); jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData);
GenesysFilterUtil.appendHtml(key, value, element); GenesysFilterUtil.appendHtml(key, value, element);
...@@ -193,10 +193,12 @@ GenesysFilter = { ...@@ -193,10 +193,12 @@ GenesysFilter = {
filterBoolean: function (element, jsonData) { filterBoolean: function (element, jsonData) {
var value = $(element).val(); var value = $(element).val();
if (value=="null") value=null; if (value=="null") value=null;
if (value=="true") value=true;
if (value=="false") value=false;
var key = $(element).attr("id"); var key = $(element).attr("id");
var checked = $(element).is(":checked"); var checked = $(element).is(":checked");
if (checked && GenesysFilterUtil.existInJson(value, key, jsonData)) { if (checked && ! GenesysFilterUtil.existInJson(value, key, jsonData)) {
GenesysFilterUtil.appendHtml(key, value, element); GenesysFilterUtil.appendHtml(key, value, element);
jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData); jsonData[key.replace("_", ":")] = GenesysFilterUtil.collectData(key, value, jsonData);
...@@ -253,15 +255,14 @@ GenesysFilterUtil = { ...@@ -253,15 +255,14 @@ GenesysFilterUtil = {
//check that value exist in json array //check that value exist in json array
existInJson: function (input, key, jsonData) { existInJson: function (input, key, jsonData) {
key = key.replace("_", ":"); key = key.replace("_", ":");
var exist = input != '';
var array = jsonData[key]; var array = jsonData[key];
for (var val in array) { for (var i=array.length-1; i>=0; i--) {
if (array[val] == input) { if (array[i] == input) {
exist = false; return true;
} }
} }
return exist; return false;
}, },
//form json array //form json array
collectData: function (key, value, jsonData) { collectData: function (key, value, jsonData) {
......
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