Foros de discusión

LazyDataModel.findRows called recursievly from unrelated search field

Abey M, modificado hace 7 años.

LazyDataModel.findRows called recursievly from unrelated search field

New Member Mensajes: 18 Fecha de incorporación: 20/01/12 Mensajes recientes
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, modificado hace 7 años.

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

Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
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, modificado hace 6 años.

RE: LazyDataModel.findRows called recursievly from unrelated search field

New Member Mensaje: 1 Fecha de incorporación: 11/05/17 Mensajes recientes
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 !!!!