Adapted tables' boolean headerfilter to be used with strings

i.e. entering 'yes' will filter all truish entries

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
Cris
2021-02-11 16:06:20 +01:00
committed by cris-technikum
parent c23a3bdac9
commit 6dea79180c
4 changed files with 40 additions and 2 deletions
@@ -117,7 +117,7 @@ $filterWidgetArray = array(
target:"_blank"
}},
anmerkung_student: {headerFilter:"input"},
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung},
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse},
status_kurzbz: {visible: false},
status_bezeichnung: {headerFilter:"input"}
}', // col properties
@@ -121,7 +121,7 @@ $filterWidgetArray = array(
target:"_blank"
}},
anmerkung_student: {headerFilter:"input"},
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung},
empfehlung_anrechnung: {headerFilter:"input", align:"center", formatter: format_empfehlung_anrechnung, headerFilterFunc: hf_filterTrueFalse},
status_kurzbz: {visible: false},
status_bezeichnung: {headerFilter:"input"}
}', // col properties
@@ -16,6 +16,25 @@ function func_height(table){
return $(window).height() * 0.50;
}
// Filters boolean values
function hf_filterTrueFalse(headerValue, rowValue){
if ('ja'.startsWith(headerValue) || 'yes'.startsWith(headerValue))
{
return rowValue == 'true';
}
if ('nein'.startsWith(headerValue) || 'no'.startsWith(headerValue))
{
return rowValue == 'false';
}
if (headerValue = '-')
{
return rowValue == null;
}
}
// Adds column details
function func_tableBuilt(table) {
table.addColumn(
@@ -16,6 +16,25 @@ function func_height(table){
return $(window).height() * 0.50;
}
// Filters boolean values
function hf_filterTrueFalse(headerValue, rowValue){
if ('ja'.startsWith(headerValue) || 'yes'.startsWith(headerValue))
{
return rowValue == 'true';
}
if ('nein'.startsWith(headerValue) || 'no'.startsWith(headerValue))
{
return rowValue == 'false';
}
if (headerValue = '-')
{
return rowValue == null;
}
}
// Adds column details
function func_tableBuilt(table) {
table.addColumn(