Hello,
I have a DataPage that uses this code in the Footer:
<script>
document.querySelectorAll(`[action*="[@cbAppKey]"] td:nth-child(2)`).forEach(function(elem) {
if(elem.innerHTML > 0) elem.style.textDecoration = "line-through";
})
document.querySelectorAll(`[action*="[@cbAppKey]"] td:nth-child(3)`).forEach(function(elem) {
if(elem.innerHTML > 0) elem.style.textDecoration = "line-through";
})
document.querySelectorAll(`[action*="[@cbAppKey]"] td:nth-child(2)`).forEach(function(elem) {
if(elem.innerHTML <= 0 ) elem.style.textDecoration = "none";
})
document.querySelectorAll(`[action*="[@cbAppKey]"] td:nth-child(3)`).forEach(function(elem) {
if(elem.innerHTML <= 0 ) elem.style.textDecoration = "none";
})
</script>
This code is used for having the data with line-through if the number is greater than 0. However, even though I input additional column such as the Calculated Field below, it would not show. It seems the code is only used for numbers and not on currency, text or other datatype. I also tried this code but no luck:
<script>
var elems = document.getElementsByTagName("td");
for (var i=0, m=elems.length; i<m; i++) {
if (elems[i].innerHTML>0)
{ elems[i].style.textDecoration = "line-through";}
}
</script>
Result:
What am I missing? I also wanted it to put line through in Text and currency datatypes? Should I convert it? Thanks!