datable lazyloading and dynamic problem

UI Components for JSF
Post Reply
enzoz
Posts: 1
Joined: 16 Aug 2010, 18:23

16 Aug 2010, 19:46

Hi Catagay,

First congrats about primefaces it's amazing!

I'm developing a page with a datatable and lazyloading enabled, this table show a datasource and the last column is a list of possible actions whit a commandLink. When the attribute 'dynamic' is FALSE de paginatior doesn't work properly, if I change the value to 'TRUE' the pagainatior works fine, but if I navigate to another page in the datatable and click in the commandLink nothing happens.

I'tried with DataTable component binding and without component binding, but apparently nothing change.
I'm using the jsf1.2 wiht the mojarra implementation and primefaces1.1

Here the code from managed bean:

Code: Select all

@PostConstruct
public String initDataTable() {

	this.form.setRequestLazyLoading(new LazyDataModel<Request>() {
		@Override
		public int getRowCount() {
			try {
				return business.count(form.getRequest(), getLoggedUser());
			} catch (BusinessException e) {
				e.printStackTrace();
			}
			return 0;
		}
	
		@Override
		public List<Request> fetchLazyData(int first, int pageSize) {
			try {
				return business.find(form.getRequest(), getLoggedUser(), first, pageSize);
			} catch (BusinessException e) {
				e.printStackTrace();
			}
			return new ArrayList<Request>();
		}
	});
	
	this.dataTable = new DataTable();
	this.dataTable.setLazy(true);
	this.dataTable.setDynamic(false);
	this.dataTable.setRows(10);
	this.dataTable.setRendered(true);
	this.dataTable.setPaginator(true);
	this.dataTable.setValue(this.form.getRequestLazyLoading());
	this.dataTable.setVar("req");
	this.dataTable.setId("dataTableRequests");
}
and here from the XHTML file:

Code: Select all

<p:dataTable binding="#{RequestManagedBean.dataTable}" >
						
	<p:column >
		<f:facet name="header">
			<h:outputText value="#{bundle['xhtml.request.datatable.requestNumber']}" />
		</f:facet>
		<h:outputText value="#{req.identifier}"/>
	</p:column>
	
	<p:column >
		<f:facet name="header">
			<h:outputText value="#{bundle['xhtml.request.datatable.subject']}" />
		</f:facet>
		<h:outputText value="#{req.subject}" />
	</p:column>
				
	<p:column>
		<f:facet name="header">
			<h:outputText value="#{bundle['xhtml.request.datatable.actions']}" />
		</f:facet>
		<p:commandLink ajax="false" value="#{bundle['xhtml.request.datatable.viewRequest']}" action="#{RequestManagedBean.view}" immediate="true" >
			<f:setPropertyActionListener target="#{RequestManagedBean.jsfAction}" value="NAV_REQUEST_VIEW" />
			<f:param name="requestId" value="#{req.id}"/>
		</p:commandLink>
		<br />
		<p:commandLink actionListener="#{RequestManagedBean.loadSelectedRequestToFoward}" ajax="true"
					   value="#{bundle['xhtml.request.datatable.forwardRequest']}" process="@form"
					   update="panelGridForwardRequest" onsuccess="fowardRequestDialog.show();" disabled="#{req.tagRequestStatus eq 'CLOSED'}">
			<f:param name="fowardRequestSelected" value="#{req}" />
		</p:commandLink>
	</p:column>
	
</p:dataTable>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

17 Aug 2010, 16:00

2.1's lazyloading has various limitations like row selection, 2.2 will have first class support for lazy data.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests