Menu

sortProperty problem?

Help
Philip
2005-09-19
2012-10-09
  • Philip

    Philip - 2005-09-19

    Greetings,

    I have a similar problem to this fellow:

    https://sourceforge.net/forum/forum.php?thread_id=1348801&forum_id=249318
    ("Sorting Numbers" by lawnboles on 2005-09-09 06:09)

    but in my case what I'm running into is that the display:column body is a formatted value (dollar amounts). So I'm trying to use sortProperty so that my values are sorted by the original numbers (and not the formatted dollar amounts).

    My problem is that I'm stuck with a for:each loop (and thus my name= attribute isn't the one from display:table) because the datastructure I use for my columns is something I inherited from another team. sortProperty doesn't seem to respect paramName (and there is no sortName). This is my code:

    <display:table name="${reqSearchResults}" id="row" export="true" pagesize="12" requestURI="Report.do?methodToCall=refresh&SomeMoreJunk">
    <c:forEach items="${row.columns}" var="column">
    <display:column class="datacell" style="text-align: right" sortable="${column.sortable}" title="${column.columnTitle}" paramName="column" sortProperty="propertyNumber">
    <fmt:formatNumber type="currency" value="${column.propertyNumber}"/>
    </display:column>
    </c:forEach>
    </display:table>

    which gives this error:

    org.displaytag.exception.RuntimeLookupException: LookupException while trying to fetch property "propertyNumber". Cause: Error looking up property "propertyNumber" in object type "org.kuali.core.web.uidraw.ResultRow"..

    Any suggestion / workaround? If the answer is not using the ResultRow datastructure and instead using something more natural to displaytag (thus getting rid of for:each), then that's fine. At least I asked on this forum and can tell that my management. ;)

    Thanks!!

    Philip

     
    • Philip

      Philip - 2005-09-20

      Hi,

      A spend a little more time on this today by studying the decorator. I think I found a solution, although I still ended up modifying this "ResultRow" object of mine. Per the post I quoted, I don't think I get around of actually having that field a Double datatype (instead of a String). Which I guess makes sense. But other then adding that field I still use the datastructure I was asked to. Here is my code, in case it helps anybody:

      <display:table name="${reqSearchResults}" id="row" export="true" pagesize="12" requestURI="Report.do?methodToCall=refresh&SomeMoreJunk">
      <c:forEach items="${row.columns}" var="column" varStatus="status">
      <display:column class="datacell" style="text-align: right" sortable="${column.sortable}" title="${column.columnTitle}" property="columns[${status.index}].propertyNumber" decorator="edu.iu.uis.fps.ere.web.displaytag.MoneyDecorator"/>
      </c:forEach>
      </display:table>

      I struggled a littlebit with the notation in the property field. I didn't know something like that can be done on JSP. Pretty spiffy, me things! O.O

      cheers,
      Philip

       

Log in to post a comment.