留言板

LazyDataModel.findRows called recursievly from unrelated search field

Abey M,修改在7 年前。

LazyDataModel.findRows called recursievly from unrelated search field

New Member 帖子: 18 加入日期: 12-1-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
Kyle Joseph Stiemann,修改在7 年前。

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

Liferay Master 帖子: 760 加入日期: 13-1-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
hoadao hoadao,修改在6 年前。

RE: LazyDataModel.findRows called recursievly from unrelated search field

New Member 发布: 1 加入日期: 17-5-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 !!!!