p:carousel issue when reRendered

UI Components for JSF
Post Reply
d.ferrazm
Posts: 3
Joined: 27 Jan 2011, 14:44

27 Jan 2011, 15:59

Hi. It seems there's an issue when trying to update a <p:carousel> after scrolling some of its items. If we stick at the first item of the carousel and update it with a p:commandButton or whatever, the carousel is rendered fine. But if the update happens after we scrolled some of the items and not go back to the first item, the carousel is rendered wrong.

test.xhtml

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

	<h:head>
		<title>Test</title>		
	</h:head>
	
	<h:body style="font-size:0.6em;">
		<h:form prependId="false">
    		<p:carousel id="carousel" value="#{testBean.someValues}" var="value" rows="1" itemStyle="width:180px; padding:5px;">
  					<h:panelGrid columns="1">
  						<h:outputText value="Content: #{value}" />
  					</h:panelGrid>
    		</p:carousel>		    		    	
	    	<p:spacer height="10"/>
	    	<p:commandButton value="update" update="carousel"/>
    	</h:form>
	</h:body>
</html>
TestBean.java

Code: Select all

@ManagedBean
@ViewScoped
public class TestBean implements Serializable{
	
	private String[] someValues = {
			"Content1",
			"Content2",
			"Content2",
			"Content4",
			"Content5",
			"Content6",
			"Content7"
	};

	public String[] getSomeValues() {
		return someValues;
	}
}
Hitting the update button at this situation (not at the first item):
Image

I got this:
Image

Other issue that I realized is regarding the <p:spacer height="10"/>. As we can see, it rendered a width space, and not a height space.

I'm using Firefox 3.6.13 and Prime 2.2 RC2.

When using Chrome, the issue is when rendering the carousel component for the first time (even before hitting update):
Image

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

27 Jan 2011, 16:03

For Chrome/WebKit browsers to work with PrimeFaces you must include a f:view tag with attribute contentType="text/html". There are lots of threads in the forum about this.

d.ferrazm
Posts: 3
Joined: 27 Jan 2011, 14:44

27 Jan 2011, 16:08

Ok. Didnt know about the f:view tag for Chrome, sorry. But the other issues still persist.

d.ferrazm
Posts: 3
Joined: 27 Jan 2011, 14:44

27 Jan 2011, 16:38

I've managed to do a workaround to resolve the problem. When the update happens, I'm forcing the carousel to go back to the first item by doing this:

Code: Select all

Carousel c = (Carousel)ComponentUtils.findComponent(FacesContext.getCurrentInstance().getViewRoot(), "carousel");
c.setFirst(0);
It seems that the nature of this issue is the kinda the same as the issue regarding datatable pagination, depicted in this thread:
http://primefaces.prime.com.tr/forum/vi ... f=3&t=6172

I've faced both issues and the solutions are pretty much alike.

Now, only the problem regarding the <p:spacer height="10"> rendering a width space that persist.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests