我写了一个 Liferay 搜索容器,效果很好。
现在我希望列可以按字母顺序排序,所以我添加了 orderable="true"
:
<liferay-ui:search-container
<liferay-ui:search-container-results
results="<%= BicycleLocalServiceUtil.getBicyclesByCompanyId(
themeDisplay.getCompanyId()) %>"
total="<%= BicyleLocalServiceUtil.getBicyclesCount() %>" />
<liferay-ui:search-container-row
className="com.example.portal.portlet.navigation.model.Bicycle"
keyProperty="bicycleId"
modelVar="bicycle"
escapedModel="<%= true %>">
<liferay-ui:search-container-column-text
name="name"
property="name"
value="<%= bicycle.getName() %>"
orderable="<%= true %>"
/>
<liferay-ui:search-container-column-text
name="nickname"
property="nickname"
orderable="<%= true %>"
/>
<liferay-ui:search-container-column-jsp
align="right"
path="/html/bicycle/bicycle_actions.jsp" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
结果看起来不错:但是 当我单击名称或任何小箭头时,下面行的顺序不会改变 .
我错过了什么吗?
我不需要任何 custom comparator因为值是简单的字符串,例如“Bob”和“Joe”。
最佳答案
您需要指定 oderableProperty
:
<liferay-ui:search-container-column-text
name="nickname"
property="nickname"
orderableProperty="nickname"
orderable="<%= true %>"
/>
关于liferay-6.2 - 向 Liferay 搜索容器添加 orderable=true,控件出现但顺序不变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35010263/