Galleria not updating images

UI Components for JSF
Post Reply
darie20
Posts: 1
Joined: 07 Jun 2014, 18:47

08 Jun 2014, 16:45

Dear community,

I have implemented a simple galleria, which reads 4 images. It's working fine so far, the galleria is displayed, as well as the filmstrip below and the captions. The autoplay also works good.

The problem: the galleria reads all 4 images correctly (they are displayed as a filmstrip in the lower part), but sticks to the last image, even when automatically switching from one image to the next one (as part of the effect). So, the image is not changed, the last one is the only one displayed in full size. After the galleria has went through all images (so, after 3 transition effects), it goes back to the first image and then everything works fine, the images change as expected.

The obvious problem is, that galleria reads all images, but is unable to start with the first image. How can I set that? Is there any property to be considered?

Here's my code, maybe you see a mistake...

The GalleriaBean:

Code: Select all

import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="galleriaBean")
@SessionScoped
public class GalleriaBean {

    private List<String> images;
    private String effect = "fade";
    
    @PostConstruct
    public void init() {
        images = new ArrayList<String>();
        for(int i = 1; i <= 4; i++) {
            images.add("gallery" + i + ".jpg");
        }
    }

    public List<String> getImages() {
        return images;
    }
    
    public void setImages(List<String> images) {
    	this.images = images;
    }

	public String getEffect() {
		return effect;
	}

	public void setEffect(String effect) {
		this.effect = effect;
	}
	
}   
and my index.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:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui"> 

	<h:head>
		<title>The PrimeFace Galleria example</title>
	</h:head>
	<h:body>
		<p:galleria value="#{galleriaBean.images}" var="image" panelWidth="500" panelHeight="350" effectSpeed="1000" showCaption="true" autoPlay="false">
			<p:graphicImage name="/images/#{image}" alt="Description for #{image}" title="#{image}" width="500" height="350"/>
		</p:galleria>
	</h:body> 
 </html>
And this is how it looks like:

Image

I would highly appreciate any help. Thanks!

DM

gilbertoastolfi
Posts: 1
Joined: 17 Jan 2015, 02:58

17 Jan 2015, 03:06

Hi darie20, I'm having the same problem, you got a solution?

coskun123
Posts: 1
Joined: 03 May 2016, 18:11

03 May 2016, 18:51

i'm having same problem too.did you find a solution?

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

06 May 2016, 11:37

Three people al with the same problem and no one states their version.

DIna0312
Posts: 1
Joined: 13 Nov 2015, 11:29
Location: UK

24 Jul 2016, 01:29

I also have this problem using Mojarra 2.2 and Primefaces 6.0 on Glassfish 4.1.1.

If anyone has any suggestions at all that would be great. :)

malikme3
Posts: 1
Joined: 19 Aug 2017, 16:02

19 Aug 2017, 16:05

It is due as in ngFor, you are not taking updated index.
so change following
[src]="image.source"
with
[src]="images[activeIndex]?.source"

have fun !

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 62 guests