如何在粘土管理工具栏中添加预先搜索?
<clay:management-toolbar
clearResultsURL="${assignmentsManagementToolbarDisplayContext.getSearchActionURL()}"
componentId="assignmentsManagementToolbar"
creationMenu="${assignmentsManagementToolbarDisplayContext.getCreationMenu()}"
disabled="${assignmentCount eq 0}"
filterDropdownItems="${assignmentsManagementToolbarDisplayContext.getFilterDropdownItems()}"
itemsTotal="${assignmentCount}"
searchActionURL="${assignmentsManagementToolbarDisplayContext.getSearchActionURL()}"
searchContainerId="assignmentEntries"
searchFormName="searchFm"
selectable="false"
showInfoButton="<%= true %>"
sortingOrder="${assignmentsManagementToolbarDisplayContext.getOrderByType()}"
sortingURL="${assignmentsManagementToolbarDisplayContext.getSortingURL()}"
viewTypeItems="${assignmentsManagementToolbarDisplayContext.getViewTypes()}"
showAdvancedSearch="<%= true %>"
searchDropdownItems="${assignmentsManagementToolbarDisplayContext.getFilterDropdownItems()}"
/>
如何添加预先搜索的功能?
view.jsp
<%
PortletURL portletURL = renderResponse.createRenderURL();
AssignmentsManagementToolbarDisplayContext assignmentsManagementToolbarDisplayContext = new AssignmentsManagementToolbarDisplayContext(renderRequest, renderResponse);
%>
<clay:management-toolbar
clearResultsURL="${assignmentsManagementToolbarDisplayContext.getSearchActionURL()}"
componentId="assignmentsManagementToolbar"
creationMenu="${assignmentsManagementToolbarDisplayContext.getCreationMenu()}"
disabled="${assignmentCount eq 0}"
filterDropdownItems="${assignmentsManagementToolbarDisplayContext.getFilterDropdownItems()}"
itemsTotal="${assignmentCount}"
searchActionURL="${assignmentsManagementToolbarDisplayContext.getSearchActionURL()}"
searchContainerId="assignmentEntries"
searchFormName="searchFm"
selectable="false"
showInfoButton="<%= true %>"
sortingOrder="${assignmentsManagementToolbarDisplayContext.getOrderByType()}"
sortingURL="${assignmentsManagementToolbarDisplayContext.getSortingURL()}"
viewTypeItems="${assignmentsManagementToolbarDisplayContext.getViewTypes()}"
showAdvancedSearch="<%= true %>"
searchDropdownItems="${assignmentsManagementToolbarDisplayContext.getFilterDropdownItems()}"
/>
class-&gt;tissionmentsManagementRequestHelper
public class AssignmentsManagementRequestHelper extends BaseRequestHelper{
public AssignmentsManagementRequestHelper(HttpServletRequest httpServletRequest) {
super(httpServletRequest);
_renderRequest = (RenderRequest)httpServletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);
_portletPreferences = _renderRequest.getPreferences();
}
public PortletPreferences getPortletPreferences() {
return _portletPreferences;
}
public RenderRequest getRenderRequest() {
return _renderRequest;
}
private final PortletPreferences _portletPreferences;
private final RenderRequest _renderRequest;
}
class-&gt;tissionmentsManagementToolbardisPlayContext
public class AssignmentsManagementToolbarDisplayContext {
public AssignmentsManagementToolbarDisplayContext(
RenderRequest renderRequest,
RenderResponse renderResponse) {
_renderRequest = renderRequest;
_renderResponse = renderResponse;
_assignmentsManagementRequestHelper = new AssignmentsManagementRequestHelper(PortalUtil.getHttpServletRequest(_renderRequest));
}
}
您可以参考模块的Liferay Portal源代码:Dynamic-Data-Lists。
Web文件夹