Carousel does not respond to change to numVisible #9049
Labels
LTS-FIXED-9.2.1
Fixed in PrimeNG LTS 9.2.1
LTS-FIXED-10.0.6
Fixed in PrimeNG LTS 10.0.6
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
I'm submitting a ... (check one with "x")
Plunkr Case (Bug Reports)
(^^^^^^^ btw you might want to fix this to "Stackblitz"):
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.
I forked the stackblitz example provided by your Carousel documentation, instead:
https://stackblitz.com/edit/primeng-carousel-demo-yivym8
Current behavior
If I change the
numVisible
programatically, the carousel advances correctly (i.e: the correct proportion of the carousel), but the item size style is was not updated, so only part of the next item is show.Expected behavior
When the numVisible changes, it should adjust the style for the .ui-carousel-item accordingly.
Minimal reproduction of the problem with instructions
Workaround: adding the following to the method that cycles the numVisible seems to fix the problem:
Uncomment this in the example to see why (the calculatePosition doesn't seem to be necessary).
EDIT: I discovered after initially posting this that the setCloneItems is necessary if the numScroll is not 1. Otherwise, the advance of the carousel is messed up. Exactly what is going on, I don't know. you get a blank carousel page. Try the example without it to see what I mean.
What is the motivation / use case for changing the behavior?
In general, component
@Input
values should respond to changes to their value.In my specific case, I have a widget that is part of a larger dashboard. The widget size may change, based on the layout, and the responsive breakpoints won't help, because the screen size is not changing, but the size of the carousel is. So I'll have to monitor the widget width and adjust the numVisible accordingly.
Please tell us about your environment:
Win10 IntelliJ
Language: [TypeScript X.X ]
Node (for AoT issues):
node --version
= 8.9.5The text was updated successfully, but these errors were encountered: