掲示板

Liferay 7 / DXP search container pagination not working

thumbnail
6年前 に Suresh Yadagiri によって更新されました。

Liferay 7 / DXP search container pagination not working

Junior Member 投稿: 29 参加年月日: 14/03/24 最新の投稿
Hello Team,

I am trying to get pagination for Liferay 7 container. I have set delta, paginate to true.. but no luck.. Any suggestions please?

<liferay-portlet:renderURL varImpl="iteratorURL"> <portlet:param name="mvcPath" value="/view.jsp" /></liferay-portlet:renderURL>
<liferay-ui:search-container id="myusers" delta="1" iteratorURL="<%= iteratorURL %>" deltaConfigurable="true" emptyResultsMessage="no-users">

<liferay-ui:search-container-results>
<%
List<MyUser> myUsersList =MyUserLocalServiceUtil.getOlyUsers(searchContainer.getStart(),searchContainer.getEnd());
results =myUsersList;
total = myUsersList.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
searchContainer.setTotal(total);
searchContainer.setResults(results);
%>
</liferay-ui:search-container-results>

<liferay-ui:search-container-row className="com.test.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 paginate="<%= true %>" displayStyle="list" searchContainer="<%= searchContainer %>"/>

</liferay-ui:search-container>
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Liferay 7 / DXP search container pagination not working

Liferay Legend 投稿: 14915 参加年月日: 06/09/02 最新の投稿
Suresh Yadagiri:
<liferay-ui:search-container-results>
<%
List<MyUser> myUsersList =MyUserLocalServiceUtil.getOlyUsers(searchContainer.getStart(),searchContainer.getEnd());
results =myUsersList;
total = myUsersList.size();
pageContext.setAttribute("results", results);
pageContext.setAttribute("total", total);
searchContainer.setTotal(total);
searchContainer.setResults(results);
%>
</liferay-ui:search-container-results>


Normally I think these values are determined outside of the search container definition in an outer scriptlet and then assigned using attributes.

For example, if you check the Liferay source such as 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, you'll see that they are doing things completely differently than how you have tried.

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.









Come meet me at Devcon 2017 or 2017 LSNA!
thumbnail
6年前 に Suresh Yadagiri によって更新されました。

RE: Liferay 7 / DXP search container pagination not working

Junior Member 投稿: 29 参加年月日: 14/03/24 最新の投稿
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..

&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>
5年前 に srini vasulu によって更新されました。

RE: Liferay 7 / DXP search container pagination not working

Regular Member 投稿: 139 参加年月日: 11/02/22 最新の投稿
Suresh Yadagiri:
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]


Hi Suresh,

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

6年前 に Ketan Solanki によって更新されました。

RE: Liferay 7 / DXP search container pagination not working

Junior Member 投稿: 63 参加年月日: 14/05/28 最新の投稿
David H Nebinger:

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.


Hi David,

Unfortunately I disagree with you.

I am currently implementing a search suggestion functionality. I took the reference of com.liferay.portal.search.elasticsearch.internal.ElasticsearchQuerySuggester 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.

Finally I asked 2 questions on this.

1. OSGi @Reference and @Component replied by yourself

2. Unable to find portal kernel search class @ runtime replied by myself

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.

and now I am getting another error while connecting to Elasticsearch embedded within Liferay - NoNodeAvailableException while invoking elasticsearch.