Hiding rows in table with empty parameter
From Project:Support desk
Hello,
i have a question about tables.
Let say that I will make a table, with several parameters by using template. For example:
Template:Parameter
{| style="border-collapse:collapse; border:solid #aaa 1px; margin:12px; font-size:90%; width:27em; padding:0.1em; text-align:left; float:right; clear:right;"
|-valign="top"
! Parameter1 :
|width="55%"| {{{Parameter1}}}
|-valign="top"
! Parameter2:
|width="55%"| {{{Parameter2}}}
|}
And on the other page, i will add posibility to fill them:
{{Template:Parameter
|parameter1=atribute1
|parameter2=atribute2
}}
If i dont add anything to "parameter2" it will show as empty box in table. Is posible, to remove or hide this entire row, if i dont fill "parameter2", so only parameters with atributes will show?
Thanks
Use ParserFunctions
{{#if:{{{Parameter1|}}}
|yes
|no
}}
Replace "|" in tables with "|" in a template {{!}}.
See for example Template:Features team notes box which does this also. It shows a "Date"-row if {{{date|}}} is given, and otherwise uses "Week" and perhaps "Time" instead.