Added FORMATTER form_formatNullToStringNumber: formats NULL to '0.00'

Now this is used to display 0.00 in Betrag-column when the value is null.
This commit is contained in:
Cris
2019-10-29 17:40:12 +01:00
committed by hainberg
parent 3129707a10
commit 998dbe7528
6 changed files with 48 additions and 3 deletions
@@ -126,6 +126,20 @@ $this->load->view(
}
}
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
var form_formatNulltoStringNumber = function(cell){
if (cell.getValue() == null){
return '0.00';
}
else {
return cell.getValue();
}
}
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
@@ -370,7 +370,7 @@ $filterWidgetArray = array(
stunden: {align:"right",
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}, width: "5%"},
betrag: {align:"right",
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"},
width: "8%"},
@@ -151,6 +151,20 @@ $this->load->view(
}
}
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
var form_formatNulltoStringNumber = function(cell){
if (cell.getValue() == null){
return '0.00';
}
else {
return cell.getValue();
}
}
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
@@ -390,7 +390,7 @@ $filterWidgetArray = array(
stunden: {align:"right",
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}},
betrag: {align:"right",
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},
vertrag_id: {visible: false},
@@ -150,6 +150,20 @@ $this->load->view(
}
}
// -----------------------------------------------------------------------------------------------------------------
// Formatters - changes display information, not the data itself
// -----------------------------------------------------------------------------------------------------------------
// Formats null values to a string number '0.00'
var form_formatNulltoStringNumber = function(cell){
if (cell.getValue() == null){
return '0.00';
}
else {
return cell.getValue();
}
}
// -----------------------------------------------------------------------------------------------------------------
// Header filter
// -----------------------------------------------------------------------------------------------------------------
@@ -218,6 +232,9 @@ $this->load->view(
var betrag = parseFloat(row.getData().betrag);
var vertrag_betrag = parseFloat(row.getData().vertrag_betrag);
// console.log(betrag);
// console.log(vertrag_betrag);
if (isNaN(betrag))
{
betrag = 0;
@@ -395,7 +395,7 @@ $filterWidgetArray = array(
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:1}},
stundensatz: {visible: false},
betrag: {align:"right",
betrag: {align:"right", formatter: form_formatNulltoStringNumber,
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money",
bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},