Liferay 7 / DXP search container pagination not workingLiferay 7 / DXP search container pagination not workinghttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=946740132024-03-28T15:06:39Z2024-03-28T15:06:39ZRE: Liferay 7 / DXP search container pagination not workingsrini vasuluhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1118451022018-12-19T21:29:40Z2018-12-19T21:29:40Z<blockquote>
<div class="quote-title">Suresh Yadagiri:</div>
<div class="quote">
<div class="quote-content">Thanks Dave. After rearranging lines as
mentioned in subscriptions example pagination is working. I think
setting total upfront in search container might be doing trick..
[code]<% int myuserCount =
MyUserLocalServiceUtil.getMyUsersCount(); %> [/code]</div></div></blockquote>
<p>
<br /> Hi Suresh,</p>
<p>i need to add the sorting for searchcontainer and
added orderByType="<%=orderByType %>" and trying to
sort it but i am not getting the hyperlinks to headers Did you
implemented in your scenario?. here i am using liferay 7</p>srini vasulu2018-12-19T21:29:40ZRE: Liferay 7 / DXP search container pagination not workingKetan Solankihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=947261262017-09-11T06:04:34Z2017-09-11T06:04:34Z<div class="quote-title">David H Nebinger:</div><blockquote><br />Remember, your best example of how to do something is directly from the Liferay source - if it works for them, it should work for you too.<br /></blockquote><br /><br />Hi David,<br /><br />Unfortunately I disagree with you. <br /><br />I am currently implementing a search suggestion functionality. I took the reference of <em>com.liferay.portal.search.elasticsearch.internal.ElasticsearchQuerySuggester</em> and developed my custom one, however that wasn't getting deployed at all. Initially it wasn't giving any error too, so I had to do basic class and go step by step and I found that many of the Import-Package statements were missing in bnd.bnd file found at <ROOT>\modules\apps\foundation\portal-search\portal-search-elasticsearch. <br /><br />Finally I asked 2 questions on this. <br /><br />1. <a href="https://web.liferay.com/community/forums/-/message_boards/message/94559727">OSGi @Reference and @Component</a> replied by yourself<br /><br />2. <a href="https://web.liferay.com/community/forums/-/message_boards/message/94652322">Unable to find portal kernel search class @ runtime</a> replied by myself<br /><br />Finally I got it deployed properly, but that process took quite some time! May be I am doing something wrong, but as far as taking reference - I guess I didn't or did I take wrong reference? I am not sure, please guild me on this. The reason I am asking this is, the things that I am implementing I am not getting enough help from online forum or any of the Liferay documents (I feel documents are pretty vague at times) and hence I have to rely on Liferay source code examples so I will use them more frequently.<br /><br />and now I am getting another error while connecting to Elasticsearch embedded within Liferay - <a href="https://web.liferay.com/community/forums/-/message_boards/message/94725519">NoNodeAvailableException while invoking elasticsearch</a>.Ketan Solanki2017-09-11T06:04:34ZRE: Liferay 7 / DXP search container pagination not workingSuresh Yadagirihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=947128422017-09-10T12:34:11Z2017-09-10T12:34:11Z<html><head></head><body>Thanks Dave. After rearranging lines as mentioned in subscriptions example pagination is working. I think setting total upfront in search container might be doing trick..<br><br><pre><code>&lt;%
int myuserCount = MyUserLocalServiceUtil.getMyUsersCount();
%&gt;
<liferay-portlet:renderurl varimpl="iteratorURL">
<portlet:param name="mvcPath" value="/view.jsp" />
</liferay-portlet:renderurl>
<liferay-ui:search-container delta="2" deltaconfigurable="<%= true %>" emptyresultsmessage="no-myusers-were-found" id="myusers" iteratorurl="<%= iteratorURL %>" total="<%= userCount %>">
<liferay-ui:search-container-results results="<%= MyUserLocalServiceUtil.getMyUsers(searchContainer.getStart(),searchContainer.getEnd()) %>" />
<liferay-ui:search-container-row classname="com.atos.ctpatp.model.MyUser" modelvar="MyUser">
<liferay-ui:search-container-column-text property="userId" />
<liferay-ui:search-container-column-text property="firstName" />
<liferay-ui:search-container-column-text property="lastName" />
</liferay-ui:search-container-row>
<liferay-ui:search-iterator markupView="lexicon" />
</liferay-ui:search-container>
</code></pre></body></html>Suresh Yadagiri2017-09-10T12:34:11ZRE: Liferay 7 / DXP search container pagination not workingDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=946955462017-09-09T06:42:56Z2017-09-09T06:42:56Z<div class="quote-title">Suresh Yadagiri:</div><blockquote><liferay-ui:search-container-results><br /><%<br />List<MyUser> myUsersList =MyUserLocalServiceUtil.getOlyUsers(searchContainer.getStart(),searchContainer.getEnd());<br />results =myUsersList;<br />total = myUsersList.size();<br />pageContext.setAttribute("results", results);<br />pageContext.setAttribute("total", total);<br />searchContainer.setTotal(total);<br />searchContainer.setResults(results);<br />%><br /></liferay-ui:search-container-results></blockquote><br /><br />Normally I think these values are determined outside of the search container definition in an outer scriptlet and then assigned using attributes.<br /><br />For example, if you check the Liferay source such as <a href="https://github.com/liferay/liferay-portal/blob/master/modules/apps/my-subscriptions/my-subscriptions-web/src/main/resources/META-INF/resources/view.jsp#L70-L80">https://github.com/liferay/liferay-portal/blob/master/modules/apps/my-subscriptions/my-subscriptions-web/src/main/resources/META-INF/resources/view.jsp#L70-L80</a>, you'll see that they are doing things completely differently than how you have tried.<br /><br />Remember, your best example of how to do something is directly from the Liferay source - if it works for them, it should work for you too.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Come meet me at <a href="https://www.eventbrite.com/e/liferay-devcon-2017-registration-29348597445">Devcon 2017</a> or <a href="https://www.eventbrite.com/e/liferay-symposium-north-america-2017-registration-28398031276">2017 LSNA!</a>David H Nebinger2017-09-09T06:42:56ZLiferay 7 / DXP search container pagination not workingSuresh Yadagirihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=946740122017-09-08T15:44:46Z2017-09-08T15:44:46ZHello Team,<br /><br />I am trying to get pagination for Liferay 7 container. I have set delta, paginate to true.. but no luck.. Any suggestions please?<br /><br /><liferay-portlet:renderURL varImpl="iteratorURL"> <portlet:param name="mvcPath" value="/view.jsp" /></liferay-portlet:renderURL><br /><liferay-ui:search-container id="myusers" delta="1" iteratorURL="<%= iteratorURL %>" deltaConfigurable="true" emptyResultsMessage="no-users"><br /> <br /><liferay-ui:search-container-results><br /><%<br />List<MyUser> myUsersList =MyUserLocalServiceUtil.getOlyUsers(searchContainer.getStart(),searchContainer.getEnd());<br />results =myUsersList;<br />total = myUsersList.size();<br />pageContext.setAttribute("results", results);<br />pageContext.setAttribute("total", total);<br />searchContainer.setTotal(total);<br />searchContainer.setResults(results);<br />%><br /></liferay-ui:search-container-results><br /><br /> <liferay-ui:search-container-row className="com.test.model.MyUser" modelVar="myuser"><br /> <liferay-ui:search-container-column-text property="userId"/><br /> <liferay-ui:search-container-column-text property="firstName"/><br /> <liferay-ui:search-container-column-text property="lastName"/><br /> </liferay-ui:search-container-row><br /> <br />