【问题标题】:How to add sorting to display tag如何添加排序以显示标签
【发布时间】:2014-07-09 04:21:28
【问题描述】:

我正在尝试在显示标签中使用排序选项。在网上看到几个例子,明白 sortable="true" 将使列可排序。将 sortable="true" 添加到列中会使列超链接,但 onclick 没有任何反应。我的意思是这两种方式都没有排序。有人可以告诉我。这就是代码的样子。

 <display-el:table sort="external" defaultsort="1" htmlId="tbl" id="row" name="tblItems" class="default" style="width:100%" export="false" cellspacing="1" cellpadding="1" pagesize="10" partialList="true" size="resultSize" decorator="abc.web.testIncludeDecorator" requestURI="${pageContext.request.contextPath}/../${requestScope.requestURI}">
                <display-el:column property="test1" title="abc" sortable="true"  class="defaultTest" style="width:2%;" />
                <display-el:column property="crid" title="def" sortable="true" class="defaultTest" style="width:2%;" />
                <display-el:column property="sample" title="ghi" sortable="true" class="defaultTest" style="width:2%;" />
</display-el:table>

【问题讨论】:

  • 非常感谢任何输入。

标签: java jstl jsp-tags displaytag


【解决方案1】:

如果您包含 sort="external",则您告诉 displayTag 您的后端代码正在执行排序(如实现 Comparable 接口)并且不需要 displayTag 帮助。 如果您包含 partialList="true",则您是在告诉 displayTag,仅显示部分项目列表而不是完整列表。

如果您正在学习如何使用 displayTag 及其内在排序行为和 tblItems 属性是简单的数据类型,如 String、int 等,(对于像类这样的用户定义类型,您需要它们再次实现 Comparable 接口)然后将您的第一行替换为并尝试:

    <display-el:table defaultsort="1" htmlId="tbl" id="row" name="tblItems" class="default" style="width:100%" export="false" cellspacing="1" cellpadding="1" pagesize="10" decorator="abc.web.testIncludeDecorator" requestURI="${pageContext.request.contextPath}/../${requestScope.requestURI}">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-19
    • 2014-07-16
    • 1970-01-01
    • 2015-06-15
    • 2020-10-15
    • 1970-01-01
    • 2014-02-20
    • 1970-01-01
    相关资源
    最近更新 更多