Directive element add remove based on condion

4 views
Skip to first unread message

Charuka Wijesinghe

unread,
Jul 13, 2017, 7:25:17 AM7/13/17
to JavaScript Templates Engine PURE
I have below problem

<table>
<tr>
<th> Name </th>
<th> Rate </th>


</tr>
<tr>
<th>  item1 </th>
<th> USD1200 </th>


</tr>
</table>



i need to hide rate column base on my java script variable value let say "var hide = true;"

base on this variable values that column should display/hide

Any Idea?????




Mic (BeeBole)

unread,
Jul 14, 2017, 4:50:38 PM7/14/17
to JavaScript Templates Engine PURE
You can use an attribute style on the TH that will be either 'display:none' or '' (empty string).
Using a class rate, for instance, to find the correct TH.

Something like:

<table>
<tr>
<th> Name </th>

<th class="rate"> Rate </th>
</tr>
...



'.rate@style':function(){
 
return this.hide ? 'display:none' : '';
}
Reply all
Reply to author
Forward
0 new messages