Forums / Setup & design / How to hide the empty fields in matrix datatype ?

How to hide the empty fields in matrix datatype ?

Author Message

Selmah Maxim

Thursday 24 July 2003 1:50:51 am

Any know how can I do this ?

I had add some bgcolor for matrix view template so the empty fields is colored now, I need to hide them , any way ?!

Selmah Maxim

Sunday 27 July 2003 3:18:16 am

?!

Selmah Maxim

Monday 28 July 2003 8:26:00 am

no one knows ?

Alex Jones

Tuesday 05 August 2003 8:59:49 am

Selmah, I finally hit the point where I have to answer this question myself. While my solution is somewhat customized, it may help you develop what you need. The matrix fields that I am trying to hide exist in a two column table that will have a specific override template for that class.

To determine whether or not to show something I am using:

{section show=$Rows:item.columns.1} {* Show the field's value *}
{$Rows:Columns:item}
{section-else} {* Display if field is empty - leave blank to display nothing *}

{/section}

Hope this helps!

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Selmah Maxim

Tuesday 05 August 2003 9:20:35 am

thx .. but this doesn`t help :(

I need to get the rows numbers ... no way what i found, but the strange I can get from matrix.tpl in another template i cann`t !!

How to get the rows number in matrix ?!?!?

Selmah Maxim

Tuesday 05 August 2003 9:28:56 am

I think I found it ..

{let
RowsNumber=count($content_version.data_map.mydata.content.rows.sequential)}
{section show=$RowsNumber|gt(0)} {*show matrix if rows > 0*}
cc
cc
{/section}
{/let}

Alex Jones

Tuesday 05 August 2003 9:30:20 am

Well, as Paul F. would ask, have you tried looking at the attributes for the row? Try something like
{$Rows:item|attribute(show)}

after

{section name=Columns loop=$Rows:item.columns}

to see what is available. I would bet you could use something along the lines of $Rows:item.rows or perhaps just grab the identifier by using $Rows:item.identifier which would output something along the lines of row_2. Please note that the variable names may need to be changed for your code, but that is where viewing the attributes comes in handy. :)

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Tuesday 05 August 2003 9:50:10 am

Great to hear! I guess I misunderstood what you were trying to do.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>