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

Fixed filterBooleans and language

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