Carousel firstVisible

UI Components for JSF
Post Reply
philipS
Posts: 8
Joined: 29 Nov 2019, 12:13

04 Dec 2019, 11:19

Hi!

I have a question concerning the carousel-component.
Even if I set the firstVisible-attribute, always the first element is displayed.
If I then call the nextNav.click() function, the element on index firstVisible+1 is displayed.

Example:

Code: Select all

<carousel widgetVar="car" numVisible="1" firstVisible="3" >
	<outputLabel value="Element 1" />
	<outputLabel value="Element 2" />
	<outputLabel value="Element 3" />
	<outputLabel value="Element 4" />
	<outputLabel value="Element 5" />
</carousel>
In this example, 'Element 1' is shown at first and as soon as I call nextNav.click(), 'Element 5' is shown.


Is there a way to fix this?

Thank you in advance for your help.
PrimeFaces 11

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

04 Dec 2019, 14:12

What happens if you remove "numvisible" property?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

philipS
Posts: 8
Joined: 29 Nov 2019, 12:13

04 Dec 2019, 14:21

In that case, 'Element 1', 'Element 2' and 'Element 3' are shown.
PrimeFaces 11

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

04 Dec 2019, 14:32

But is your firstVisible="3" shown correctly? what I am trying to narrow down is whether by only displaying 1 that is the issue because there is no index 3 when you are only displaying 1.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

philipS
Posts: 8
Joined: 29 Nov 2019, 12:13

04 Dec 2019, 14:45

FirstVisible="3" means that 'Element 4' should be displayed, right?
But if I remove the numVisible-property, 'Element 1' - 'Element 3' are shown, which means that firstVisible="3" is not set correctly.
PrimeFaces 11

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

04 Dec 2019, 14:54

OK i would create a bug then here: https://github.com/primefaces/primefaces/issues

Make sure to follow all the steps and create a reproducible sample using the PrimeFaces Test project.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

philipS
Posts: 8
Joined: 29 Nov 2019, 12:13

05 Dec 2019, 16:44

Thank you for your answer!

My workaround at the moment is to set the page of the carousel myself onload:

Code: Select all

<p:remoteCommand name="onload" oncomplete="PF('carousel').setPage(3);" update="carousel" />
PrimeFaces 11

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests