DataTable component

UI Components for JSF
Post Reply
lara0011
Posts: 2
Joined: 21 Mar 2011, 05:18

06 Apr 2011, 09:24

Why is the DataTable component built-in functionality for paging and sorting behavior differ from PrimeFaces 1.1 and 2.2.1?

Signature contains jar and server info and the below applies to both examples:
Managed Bean Scope: Request

primefaces 1.1 example:

1. load page: (got expected behavior)
Image

2. execute call to load table: (got expected behavior)
Image

3. clicked on paginator page link: (got expected behavior)
Image

4. clicked on last name column to execute sort: (got expected behavior)
Image

primefaces 2.2.1 example:

1. load page: (got expected behavior)
Image

2. execute call to load table: (got expected behavior)
Image

3. clicked on paginator page link: (did NOT get expected behavior)
Image

- Note: The data was lost.

4. executed to load data table and clicked on last name column to execute sort: (did NOT get expected behavior)
Image

- Note: The data was lost.


I noticed during the evaluation of the DataTable component, in 1.1 a call to the server is never initiated to get the list when using the paging and sorting features. When using the same component in 2.2.1 a call to the server is initiated to retrieve the managed bean list, but at this point it is a new request and i don't expect the list to have any data because the beans scope. i could be wrong, so a clarification would be appreciated.
Last edited by lara0011 on 08 Apr 2011, 03:57, edited 1 time in total.
Primefaces-1.1
JSF 1.2 - Mojarra 1.2_14-b01-FCS
- jsf-api.jar
- jsf-impl.jar

Primefaces-2.2.1
JSF 2.0 - Mojarra 2.0.3-FCS
- jsf-api.jar
- jsf-impl.jar

Tomcat 6.0.29

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

06 Apr 2011, 10:31

Hi, can you check if you're getting an ArithmeticException in your server
log? there is a known issue. Can you also post your bean code for quoteList.

Regards,
Brendan.

lara0011
Posts: 2
Joined: 21 Mar 2011, 05:18

07 Apr 2011, 04:05

Brendan, the logs are clean and I don't see an ArithmeticException logged on the server side. Also, the same exact faces config and bean code is used in both implementions of primefaces versions indicated in my posting signature.

facesConfig excerpt:

Code: Select all

<managed-bean>
   	<managed-bean-name>quoteBean</managed-bean-name>
   	<managed-bean-class>com.test.poc.model.QuoteBean</managed-bean-class>
   	<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
quoteBean:

Code: Select all

package com.test.poc.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.test.poc.dto.Quote;
import com.test.poc.dto.QuoteSearchCriteria;

public class QuoteBean implements Serializable {
	
	private static final long serialVersionUID = 1L;

	private QuoteSearchCriteria searchCriteria;
	
	private List<Quote> quoteList;

	public List<Quote> getQuoteList() {
		
		if(quoteList == null)
		{
			quoteList = new ArrayList<Quote>();
		}
		
		return quoteList;
	}

	public void setQuoteList(List<Quote> quoteList) {
		this.quoteList = quoteList;
	}

	public QuoteSearchCriteria getSearchCriteria() {
		if(searchCriteria == null)
		{
			searchCriteria = new QuoteSearchCriteria();
		}
		return searchCriteria;
	}

	public void setSearchCriteria(QuoteSearchCriteria searchCriteria) {
		this.searchCriteria = searchCriteria;
	}
}
Here is the bean that actually initializes the quoteList when the searchButton is clicked. The search method is executed when the button is clicked:

facesConfig excerpt:

Code: Select all

<managed-bean>
	<managed-bean-name>searchController</managed-bean-name>
	<managed-bean-class>com.test.poc.controller.SearchController</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
	<managed-property>
		<property-name>quoteDataList</property-name>
	 	<list-entries>
	 		<value-class>com.test.poc.dto.Quote</value-class>
	 		<value>#{Quote1}</value>
	 		<value>#{Quote2}</value>
			<value>#{Quote3}</value>
			<value>#{Quote4}</value>
	 		<value>#{Quote5}</value>
	 		<value>#{Quote6}</value>
	 	</list-entries>
	</managed-property>
</managed-bean>
searchControllerBean:

Code: Select all

package com.test.poc.controller;

import java.io.Serializable;
import java.util.List;

import javax.faces.context.FacesContext;

import com.test.poc.dto.Quote;
import com.test.poc.model.QuoteBean;

public class SearchController implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private List<Quote> quoteDataList;

	public void setQuoteDataList(List<Quote> quoteDataList) {
		this.quoteDataList = quoteDataList;
	}
	
	public String search()
	{
		String outcome = null;
		
		FacesContext cxt = FacesContext.getCurrentInstance();
		QuoteBean quoteBean = (QuoteBean) cxt.getApplication().evaluateExpressionGet(cxt, "#{quoteBean}", QuoteBean.class);
		
		if(quoteBean != null)
		{
			if(quoteBean.getSearchCriteria().isSearchCriteriaSet())
			{
				quoteBean.setQuoteList(quoteDataList);
			}
		}
		
		return outcome;
	}

}
the symptom of the data being lost doesn't look to be isolated to just the paging and sorting features.
Primefaces-1.1
JSF 1.2 - Mojarra 1.2_14-b01-FCS
- jsf-api.jar
- jsf-impl.jar

Primefaces-2.2.1
JSF 2.0 - Mojarra 2.0.3-FCS
- jsf-api.jar
- jsf-impl.jar

Tomcat 6.0.29

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests