Examples of using the <display:row /> tag.
Note that by default it will behave exactly the same as it
did
in previous displaytag implementations, that is rows will
have
<tr class="tableRowOdd"> ...
<tr class="tableRowEven">...
attributes set.
Now it is possible to disable this behaviour, simply by
<display:row styleClass=""/> --> always: <tr>
or
<display:row styleClass="myClass"/> --> always:
<tr class="myClass">
Skipping this attribute, will give the default behaviour.
Now it is also possible to set all other standard
attributes,
as defined by the W3C organisation.
See http://www.w3.org/TR/html4/struct/tables.html#h-
11.2.5 for details.
It is also possible to define and use self made row
decorator.
To do it, simply specify the 'decorator' property:
<display:row
decorator="pl.sagware.display.MyRowDecorator">
with some custom class name that extends the
RowDecorator class.
This decorator has access to all 'standard' decorator
properties:
=================================
1) Example that that clears the styleClass attribute
(setting this attribute disables setting it automatically
to tableRowOdd/tableRowEven)
and changes the row color on some mouse event.
<display:row onmouseover="this.bgColor='#ffcc00';"
onmouseout="this.bgColor='#FFFFFF';" styleClass=""/>
2) This example does not modify the default behaviour of
the row style setting
(tableRowOdd/tableRowEven is set as always before),
and adds some action
on 2 javascript events.
<display:row onmouseover="window.status='Hi! I am
here!';" onmouseout="window.status=''"/>
Dariusz Wojtas
Patch containing required files, and description of changes to TableTag to use it
Logged In: YES
user_id=226669
I need something like this in my project, and I currently
can think of no way to change the 's class on a per-row
basis. I'll see if I can patch the source and test it out.
If I like it and it works for me, I'll review it with the
dev team and hopefully we can add it.
Logged In: YES
user_id=226669
After reviewing the patch, and the current code, it looks
like this was written for displaytag 0.8.5, rather than
1.0.x. If you'll modify your patch for the latest code, I
can look at it again.
Matt