2010/2/17 Rick.Wellman <rick.well...@kiewit.com>
> Not sure what you’re trying to do in your decorator but you have access
> to the ticket object in the decorator. Is there a reason you are using EL
> expressions instead of just accessing the object in your decorator?
>
>
>
> *From:* Rob van Oostrum [mailto:rva...@gmail.com]
> *Sent:* Wednesday, February 17, 2010 12:05 PM
> *To:* displaytag-user@lists.sourceforge.net
> *Subject:* [displaytag-user] display:table id attribute not updating
>
>
>
> I tried the following:
>
>
>
> <display:table name="tickets" id="ticket" >
>
> <display:column property="id" url="/ticket/${ticket.id}"
> decorator="my.IdColumnDecorator" />
>
>
>
> While the EL resolves, it seems to result in ${ticket} being stuck on the
> first item in the list. If I do this instead it works:
>
>
>
> <display:column><a href="<c:url value='/ticket/${ticket.id}'/>">${
> ticket.id}</a></display:column>
>
>
>
> But that workaround renders my decorator useless.
>
>
>
> Is this a known issue? Am I doing something wrong? I searched the issue
> tracker but didn't come across anything.
>
>
> Thanks
> Rob
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
The issue is not with the decorator. To give you a concrete example of
what's happening, if I have a list of objects like so:
id title (etc)
=============
1 First Title
2 Second Title
(etc)
And I display the table like so:
<display:table name="tickets" id="ticket" >
<display:column property="id" url="/ticket/${ticket.id}" />
the ${ticket.id} in the url attribute's value resolves to '1' for all rows
in the collection. The id property specified in the property attribute does
resolve to the correct value for each row. It seems that as soon as I use an
EL reference to (in this case) 'ticket' in the value of any attribute of
display:column, it locks onto the first item in the list, so what I see is:
1 (with url to /ticket/1) First Title
2 (with url to /ticket/1) Second Title
This is using displaytag 1.2 on both Tomcat 5 and 6 (webapp versions 2.4 and
2.5).
FYI, he inclusion of the decorator was merely justification for why the
workaround mentioned doesn't really work for me. My ID Strings are 64-byte
hex Strings, so the decorator shortens the String for display purposes:
public class IdColumnDecorator implements DisplaytagColumnDecorator {
@Override
public Object decorate(Object columnValue, PageContext pageContext,
MediaTypeEnum media)
throws DecoratorException {
String value = (String) columnValue;
String displayValue = value.substring(0, 4) + "..."
+ value.substring(value.length() - 4, value.length());
return displayValue;
}
}
If I take the decorator out altogether, it only changes the display value of
the id, it doesn't affect the issue with '${ticket}' being stuck on the
first item in the list.
Thanks
Rob
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user