Carousel firstVisible

UI Components for JSF
Post Reply
philipS
Posts: 4
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 7.0
PrimeFaces Extensions 7.0.1

Melloware
Posts: 1384
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 7.0.8 / PF Extensions 7.0.3

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

04 Dec 2019, 14:21

In that case, 'Element 1', 'Element 2' and 'Element 3' are shown.
PrimeFaces 7.0
PrimeFaces Extensions 7.0.1

Melloware
Posts: 1384
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 7.0.8 / PF Extensions 7.0.3

philipS
Posts: 4
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 7.0
PrimeFaces Extensions 7.0.1

Melloware
Posts: 1384
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 7.0.8 / PF Extensions 7.0.3

philipS
Posts: 4
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 7.0
PrimeFaces Extensions 7.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests