Mutiple search containers is not working properly
Written By
Pooja Bhambani
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- If users have multiple search containers in the same widget, first search container is showing results in the second container and vice versa.
- Expected results would be in the below 'view.jsp' is 'test1' comes under search container 1 and 'test' comes under search container 2, and the same results would be shown on the UI (row of the first container should not be added in the second container)
<h1>MULTIPLE SEARCH CONTAINER</h1>
<h2>SEARCH CONTAINER 1</h2>
<liferay-ui:search-container emptyResultsMessage="no-users-have-been-assigned-to-this-segment" iteratorURL="<%= carrierProfileContainerURL1 %>"
total="2"
var="testSearchContainer1"
curParam="storeCur1" >
<liferay-ui:search-container-results results="<%= test1 %>"/>
<liferay-ui:search-container-row modelVar="user1" className="java.lang.String">
<liferay-ui:search-container-column-text>${user1}</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator
displayStyle="descriptive"
markupView="lexicon" />
</liferay-ui:search-container>
<h2>SEARCH CONTAINER 2</h2>
<liferay-ui:search-container
emptyResultsMessage="no-users-have-been-assigned-to-this-segment" iteratorURL="<%= carrierProfileContainerURL %>" total="2" var="testSearchContainer" curParam="storeCur">
<liferay-ui:search-container-results results="<%= test %>" />
<liferay-ui:search-container-row modelVar="user2" className="java.lang.String">
<liferay-ui:search-container-column-text>${user2}</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator
displayStyle="descriptive"
markupView="lexicon"/>
</liferay-ui:search-container>
Resolution
- In order to correctly show results on the UI (test1' under search container 1 and 'test' under search container 2), users need to add id property to every search container to avoid results getting mixed when there is more than one search container within the same widget.
Did this article resolve your issue ?