[display:table] How to display a column according to another column value

I was using <display:table> tag for a client list, and needed to start each row with a picture depending on the client status. This was implemented by creating a status table in my database, containing le status ID, label and picture to be dislayed.

<display:table name=”clients” uid=”client” sort=”list” partialList=”false” size=”${size}” pagesize=”5″ requestURI=”” export=”false” id=”idTable”>
<display:column title=”” media=”html” headerClass=”empty”>
<a href=”${idTable.status.href}?id=${idTable.id}“>
<img title=”${idTable.status.title}” src=”${idTable.status.file}“/>
</a>
</display:column>
<display:column title=”Id” property=”id” sortable=”true”/>
<display:column title=”Client name” property=”name” sortable=”true”/>
<display:column title=”status” property=”status.label” sortable=”true”/>
</display:table>

Here is the thread I opened on a French programming forum: http://www.developpez.net/forums/d1126540/java/developpement-web-java/frameworks/struts/struts-2/display-tag-afficher-colonne-fonction-colonne/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: