Techno Spike wrote:
> I have a doubt about the display tag that would help me a great deal to be
> solved. Is it possible to use in the display tag a list of primitive
> types?
> I would like to use a list of Longs to be displayed, and I have managed
> that. However, I would also like to be able to sort the list, and that is
> something that I can't complete. When listing beans, I understand how to
> do
> it, but in case of a Long, how do I indicate in the display:column which
> is
> the sortable property? Can I sort a list of Longs at all?

Short answer: yes, no problem at all.

> I was trying to make this code:
>
> <display:table id="Long" name="list" cellspacing="1" cellpadding="5"
> requestURIcontext="" requestURI="listall.do"  sort="list" pagesize="10">
>   <display:column titleKey="Year" sortable="true" sortProperty="longValue"
> media="html">
>       <a href="<c:url value="/person/listantigosalunosbyclass.do">
>         <c:param name="class" value="${Long}" /></c:url>">
>         <c:out value="${Long}" /></a>
>   </display:column>
> </display:table>
>
> But, although the list is well formed, when I try to sort it, it just
> doesn't work. Any sugestions on how to do this, or indication if it is
> possible to do this or not, would be apreciated.

My guess is that it's just a naming issue.  It looks like you're trying to
use the property "longValue" as your sortProperty, but then within the
column, you're referring to "Long".  So which is it?  If that's just
something that happened because of genericizing the code, that's one
thing, but those should be the same.  The question is, what is the name of
the getter function that will give display:tag the value to be sorted?  If
it's "getLong()" then you should refer to that as "long".  If it's
"getLongValue()" then you should refer to it as "longValue".  In BOTH
cases, the property on which you'll sort should be the same.  In the code
below, I'm assuming that it's "getLongValue()":

<display:column titleKey="Year" sortable="true" sortProperty="longValue">
   <a href="<c:url value="/person/listantigosalunosbyclass.do">
      <c:param name="class" value="${longValue}" /></c:url>">
      <c:out value="${longValue}" />
   </a>
</display:column>

Hope that helps...

-- 
Rick Herrick
[EMAIL PROTECTED]

Proud member of the reality-based community

Never try to discourage thinking for you are sure to succeed.--Bertrand
Russell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to