掲示板

LazyDataModel.findRows called recursievly from unrelated search field

7年前 に Abey M によって更新されました。

LazyDataModel.findRows called recursievly from unrelated search field

New Member 投稿: 18 参加年月日: 12/01/20 最新の投稿
Hi,
I am using the Lazy data model for populating the ui table.
I noticed that when changing the value in start date in search criteria, the findRows method is recursively called, causing multiple calls to the backend before the values are set. This is causing heavy backend traffic and bugs.
How can I make icefaces to call findRows only on clicking the Search button?
Thank you.

The DTO class is
public class MyTO implements com.liferay.faces.util.model.LazyDataModel
...
@Override
	public List<myto> findRows(int startRow, int finishRow) {
		return service.geRecords(this, startRow,
				(finishRow - startRow) + 1);
		//return null;
	}
...
}</myto>


The xhtml is
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ace="http://www.icefaces.org/icefaces/components" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:icecore="http://www.icefaces.org/icefaces/core">

	<f:loadbundle basename="messages" var="msg" />
	<h:head></h:head>
	<h:body>
	<ice:portlet>
		<ice:outputstyle href="#{msg['icefaces.portlet.style.rime.css']}" />
		<ice:outputstyle href="#{msg['icefaces.portlet.style.showcase.css']}" />
		<ice:form>			
				<ice:panelgroup>
					<ice:selectinputdate id="formStartDate" binding="#{myBean.startDateComp}" value="#{myBean.startDate}" renderaspopup="true" highlightclass="weekend" highlightunit="DAY_OF_WEEK" highlightvalue="1,7" label="#{msg['my.search.form.field.startdate.text']}">
						<f:convertdatetime pattern="#{msg['my.form.date.format']}" timeZone="#{msg['my.time.zone']}" />
					</ice:selectinputdate>
					<h:message style="color: red" for="formStartDate" />
				</ice:panelgroup>


			<ice:panelgrid columns="2" cellpadding="15px">
				<ice:commandbutton id="SubmitBtn" type="submit" value="submit" actionListener="#{myBean.searchButtonListener}" />
				<ice:commandbutton id="ClearBtn" value="clear" actionListener="#{myBean.clearButtonListener}" immediate="true" />
			</ice:panelgrid>
			
			<ice:panelcollapsible id="batchGroupPanel" expanded="true" immediate="true">
					<ice:datatable id="myResultTable" var="record" value="#{myBean.searchResults}" rows="#{myBean.searchResults.rowsPerPage}" scrollable="false" columnwidths="110px,100px,300px" cellpadding="0" style="background-color:white" columnclasses="myDatatableElement,myDatatableElementLeft,myDatatableElementLeft" headerclasses="myDatatableElement" width="100%">
			</ice:datatable></ice:panelcollapsible>
		</ice:form>
	</ice:portlet>
	</h:body>
</f:view>

thumbnail
7年前 に Kyle Joseph Stiemann によって更新されました。

RE: LazyDataModel.findRows called recursievly from unrelated search field (回答)

Liferay Master 投稿: 760 参加年月日: 13/01/14 最新の投稿
Hi Abey,
Can you try ace:dataTable with IceFaces LazyDataModel instead?

There's an example of how to use ace:dataTable with a LazyDataModel implementation in our old icefaces-users-portlet.

- Kyle
6年前 に hoadao hoadao によって更新されました。

RE: LazyDataModel.findRows called recursievly from unrelated search field

New Member 投稿: 1 参加年月日: 17/05/11 最新の投稿
Kyle Joseph Stiemann:
Hi Abey,
Can you try ace:dataTable with IceFaces LazyDataModel instead?

There's an example of how to use ace:dataTable with a LazyDataModel implementation in our old icefaces-users-portlet.

- Kyle

Thank you !!!!