My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 108: Custom CSS per column
  Back to list
Status:  Invalid
Owner:  ----
Closed:  Jul 2008


 
Reported by oscarfer...@gmail.com, Jun 6, 2008
Hi,
Is there an easy way to apply a css class per different row?
My problem is that I would like to render differently rows that contain a
boolean flag = false. I tried something like it but won't work..:

<jmesa:tableFacade id="places" items="${places}" maxRows="10"
exportTypes="csv,excel" maxRowsIncrements="10,20,1000" stateAttr="restore"
var="bean">
	<jmesa:htmlTable captionKey="places.list">
		<c:set var="dtstyle" value=""/>
		<c:if test="${bean.active == false}">
	  		<c:set var="dtstyle" value="disable"/>
	    </c:if>
		<jmesa:htmlRow styleClass="${dtstyle}">
			<jmesa:htmlColumn property="name" titleKey="place.name" />
.....
A workaround ugly but efficient is to apply the class within the tag like
that..:
<jmesa:htmlColumn property="name" titleKey="place.name" >
   <p class="${dtstyle}">${bean.name}</p>
</jmesa:htmlColumn>

I was using displaytag previously and the above code worked like a charm.
Is there an easy solution for my problem?
Thanks!
oscar

 
Jun 6, 2008
#1 extremec...@gmail.com

What you need to do is implement your own row renderer. The best way to do this would
be to extend the HtmlRowRendererImpl and override the render() method. You can just
copy the exiting method and tweak it to your needs. It is only a few lines long...

https://code.google.com/p/jmesa/source/browse/trunk/jmesa/src/org/jmesa/view/html/renderer/HtmlRowRendererImpl.java

Then you can just plug in it by using the rowRenderer attribute on the row. You just
need to give the fully qualified path to your imlementation.

<jmesa:row rowRenderer="com.mycompany.MyCustomRowRenderer">

Hope that helps!

P.S. If you wouldn't mind posting these kind of questions on the wiki that would be
very helpful for me as that is a more logical place to look for answers to questions :).







Jun 6, 2008
#2 oscarfer...@gmail.com
thanks for your quick response!
and sorry I posted my question on issues rather than on the wiki. I just thought that
the way the wiki is created is more like a recipes page than a place to ask new
questions but I will use the wiki from now on.
Jun 6, 2008
#3 oscarfer...@gmail.com
Maybe I am missing something but .. how do I create a new page in the wiki? Do we
have the rights to edit/create pages?..
Jun 6, 2008
#4 extremec...@gmail.com
My mistake :). I meant in the Google Groups...

http://groups.google.com/group/jmesa

Jun 7, 2008
#5 oscarfer...@gmail.com
opps. thanks, I will do so :)
Jun 7, 2008
#6 oscarfer...@gmail.com
opps. thanks, I will do so :)
Jul 3, 2008
#7 extremec...@gmail.com
(No comment was entered for this change.)
Status: Invalid

Powered by Google Project Hosting