Table Formatting Working

This commit is contained in:
Luis Fernando Molina committed 2021-07-16 16:14:31 +02:00
1 parent 33e36c0355
commit 273300a61d
1 file changed
+21 -2
+21 -2
View File
@@ -130,12 +130,31 @@ function newGovernanceUtilitiesTables() {
let propertyDefinition = tableRecordDefinition.properties[i]
if (property === propertyDefinition.name) {
textAligment = propertyDefinition.textAlign
format = propertyDefinition.format
format = propertyDefinition.format
break
}
}
let value = tableRecord[property]
switch (format) {
case 'text': {
HTML = HTML + '<td style="text-align:' + textAligment + ';">' + tableRecord[property] + '</td>'
break
}
case 'integer': {
value = parseFloat(value.toFixed(0)).toLocaleString('en')
break
}
case '2 decimals': {
value = parseFloat(value.toFixed(2)).toLocaleString('en')
break
}
case 'percentage': {
if (isNaN(value)) { value = 0 }
value = (value * 100).toFixed(2) + " %"
break
}
}
HTML = HTML + '<td style="text-align:' + textAligment + ';">' + value + '</td>'
}
}