conditionals in print templates #227
-
hello devs me again, practicing with totum took me with a limitation owell I didn't find an answer in the documentation when creating a print template I wanted to make "if" conditionals so that depending on the result condition it shows or hides a similar part of the template to what they use to hide unwanted columns, is it possible to do that?? at the template level because doing it in the print button code would be very long, also how can you access the visibility status of the columns??, it would be great to have that function and it would greatly save development time |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Our lead thinks that it can be done with CSS in the template. I asked her about some examples, and I will post them here when they are ready. |
Beta Was this translation helpful? Give feedback.
-
You can do this with the {style}
<table id="print_table">
<thead><tr><td>test1</td><td>test2</td><td>test3</td></tr></thead>
<tbody>
<tr><td>test1</td><td>test2</td><td>test3</td></tr>
</tbody>
</table> <style>
#print_table td{
border: 1px solid black;
}
#print_table td:nth-child(2){
display: none
}
</style>
<table id="print_table">
<thead><tr><td>test1</td><td>test2</td><td>test3</td></tr></thead>
<tbody>
<tr><td>test1</td><td>test2</td><td>test3</td></tr>
</tbody>
</table> |
Beta Was this translation helpful? Give feedback.
You can do this with the
<style>
-part in print template. You can add it with the{...}
variable and hide the item in the template withdisplay: none
. For example: