<TR> BG Color depending on a field value

Hello everybody

I hope yout had a got start into the new Year :)

I'm trying to make a huge amount of data better "readable".
For example:

Database with cars, all of them are listet in the grid, but some of them are sold.
So i want to add the <tr class="rowodd SOLD"...

So it's realy easy to see wich cars are interesting for me.

But I'm not able to "echo" the value in my grid.tpl.

Can anyone help me?

 

best reagards

Hello I solved it this

Hello

I solved it this way:
When the row (tr) is created a use another foreach wich writes the status but i had to replace the span tag.

I know there must be a more perfomance-friendly way to solve that but this solution is for now enough ;)

I used thes now also for cells (my cell is status => god bad or middle) and every bad or middle cell have now their own background color:


         {foreach key=name item=cell from=$row}
            {if $cell != ''}
              <td valign=top class="cell {if $name == 'value_i_am_lloking_for' || $name == 'value_i_am_lloking_for2'}styleprefix_{$cell|replace:'<span STYLE=\'\' >':''|replace:'</span>':''}{/if}"  >{$cell}</td>
            {else}
              <td valign=top class=cell>&nbsp;</td>
            {/if}
         {/foreach}



Output : class="cell styleprefix_good"

 

best regards

if smarty is new to you. you

if smarty is new to you. you can use PHP template. You can refer to the sample in baseapp/modules/easy/f_AttendeeList.xml

Hello Hmm i can't figure it

Hello

Hmm i can't figure it out how to use the one attribute from the actual row.
I'm not uswd to smarty  - i know just the basics :(

$datapanel.data[5] shows just "array" and I think I forgot something important. :(

I think I must use the row $datapanel.data.row.[X] or am i wrog?
Can you post a litle example ? please :(

 

best regards

 

 

In the smarty template,

In the smarty template, $dataPanel.data is an index array. Each entry of the array is record.  You can use the one field of the record to tell if the car is SOLD and give it a different color.