Liferay 7 Панель управления глиной
Как добавить расширенный поиск на панели инструментов управления глиной?
<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()}"
/>
Как добавить функционал расширенного поиска?
1 ответ
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()}"
/>
класс -> AssignmentsManagementRequestHelper
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;
}
класс ->AssignmentsManagementToolbarDisplayContext
public class AssignmentsManagementToolbarDisplayContext {
public AssignmentsManagementToolbarDisplayContext(
RenderRequest renderRequest,
RenderResponse renderResponse) {
_renderRequest = renderRequest;
_renderResponse = renderResponse;
_assignmentsManagementRequestHelper = new AssignmentsManagementRequestHelper(PortalUtil.getHttpServletRequest(_renderRequest));
}
}
Вы можете обратиться к исходному коду портала Liferay для модуля: динамические списки данных.
веб-папка