排序不在显示标签中工作

时间:2013-01-30 05:53:30

标签: java struts displaytag

在下面的代码中,我必须使用sortable = true对显示标记中的平衡列进行排序,但它不起作用,当我在bean中定义此值以进行格式化并放置货币符号(从会话对象获取货币符号) 。

<% String strCurrency=(String)session.getAttribute("strCurrency"); %>

    <display:table id="data1" name="invprbmList" requestURI=""  pagesize="10" export="true" style="width:100%;">
    <tr>
     <td><display:setProperty name="paging.banner.item_name">Invoice</display:setProperty>
     <display:setProperty name="paging.banner.items_name">Invoices</display:setProperty>
     <display:setProperty name="paging.banner.some_items_found"><span class="pagebanner"> {0} Invoices found, displaying {2} to {3}. </span></display:setProperty>              
     <bean:define id="invoiceNo"><bean:write name="data1" property="invoiceNo"/></bean:define>
     <bean:define id="invAmt"><bean:write name="data1" property="invAmount" format="#,##,##0.00"/></bean:define>
     <bean:define id="balance"><bean:write name="data1" property="balance" format="#,##,##0.00"/></bean:define>

     <display:column  title="Invoice No." sortable="true" media="html" class="l" headerClass="hl"><a href="GetInvoiceShippingDetails.do?invoiceNo=<%=invoiceNo%>&custno=<%=custno%>"><%=invoiceNo%></a></display:column>
     <display:column  property="invDate" title="Invoice Date" format="{0,date,dd-MMM-yyyy}" sortable="true" class="l" headerClass="hl"/>
     <display:column  media="html" title="Amount" sortable="true" class="r" headerClass="hr"><%=strCurrency%><%=invAmt %></display:column>
     <display:column  property="dueDate"    title="Due Date" format="{0,date,dd-MMM-yyyy}" sortable="true" class="l" headerClass="hl"/>
     <display:column  media="html" title="Balance" sortable="true" class="r" headerClass="hr"><%=strCurrency%><%=balance %></display:column>
     <display:column  title="Balance" sortable="true" property="balance" media="xml csv pdf excel" class="r" headerClass="hr" />
     <display:column  property="followUpDate" title="Follow-up Date" format="{0,date,dd-MMM-yyyy}" sortable="true" class="l" headerClass="hl"/>
     </td>
    </tr>
    </display:table>

1 个答案:

答案 0 :(得分:0)

你可以在bean中创建另一个属性来格式化balance(在get方法中),例如使用set和get的balanceHtml,然后显示为<display:column property="balanceHtml" sortable="true"/>