1
Good afternoon, I have a table where I show several values, but I have lines where sometimes I have no number and shows N.A.
What I want is to delete a row from the table (div id="ApagarNA"
) if all columns in that row have N.A.
In the code I’m using Angularjs, and I’ve tried using ng-if="!item.Last && !item.LastUm && !item.LastDois && !item.LastTres"
on the div I want to delete, but it erases the line even if some column has numbers, and should not.
The table is this:
And here is a part of my code that corresponds to show one of the lines. For the remaining lines the code is similar.
<!-- 2WK Type -->
<div id="ApagarNA" data-ng-if=$odd class="tableRowOdd" data-ng-show="item.TipoOWS === '2WK'">
<div class="tableCellContent20">
<h3 class="cellTextType" ><span>{{::item.TipoCalculado.split('#')[1]}}</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.Last"><span>{{::item.Last.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.Last"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastUm"><span>{{::item.LastUm.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastUm"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastDois"><span>{{::item.LastDois.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastDois"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastTres"><span>{{::item.LastTres.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastTres"><span>N.A.</span></h3>
</div>
</div>
<div id="ApagarNA" data-ng-if=$even class="tableRowEven" data-ng-show="item.TipoOWS === '2WK'">
<div class="tableCellContent20">
<h3 class="cellTextType" ><span>{{::item.TipoCalculado.split('#')[1]}}</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.Last"><span>{{::item.Last.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.Last"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastUm"><span>{{::item.LastUm.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastUm"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastDois"><span>{{::item.LastDois.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastDois"><span>N.A.</span></h3>
</div>
<div class="tableCellContent20">
<h3 class="cellTextValue" data-ng-show="item.LastTres"><span>{{::item.LastTres.replace('.',',') | limitTo:7:0}}</span></h3>
<h3 id="apagarcampo" class="cellTextValueNA" data-ng-show="!item.LastTres"><span>N.A.</span></h3>
</div>
</div>
I have tried with Javascript, but it happens the same, delete even if one of the columns has number.
<script type="text/javascript">
var nove_meses = document.getElementById('ApagarNA');
var h3s = document.querySelectorAll('#apagarcampo span');
for(var i = 0; i < h3s.length; i++) {
console.log(h3s[i].innerText);
if(h3s[i].innerText == 'N.A.') {
nove_meses.style.display = 'none';
}
}
</script>
That table of yours is a little weird. You’re using
AngularJS
pure?– Sorack