Foren

LazyDataModel.findRows called recursievly from unrelated search field

Abey M, geändert vor 7 Jahren.

LazyDataModel.findRows called recursievly from unrelated search field

New Member Beiträge: 18 Beitrittsdatum: 20.01.12 Neueste Beiträge
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
Kyle Joseph Stiemann, geändert vor 7 Jahren.

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

Liferay Master Beiträge: 760 Beitrittsdatum: 14.01.13 Neueste Beiträge
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
hoadao hoadao, geändert vor 6 Jahren.

RE: LazyDataModel.findRows called recursievly from unrelated search field

New Member Beitrag: 1 Beitrittsdatum: 11.05.17 Neueste Beiträge
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 !!!!