Carousel doesn't use 'responsiveOptions' on init #8833
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)
https://stackblitz.com/edit/github-6dh6gj-8br5fm
Current behavior
On initialization Carousel is using values provided in html:
numVisible
&numScroll
to calculate eg. number of pages.Expected behavior
On initialization Carousel should use values provided in html:
numVisible
&numScroll
&responsiveOptions
to calculate eg. number of pages.Minimal reproduction of the problem with instructions
If you change panel width again (1px would be enough), number of pages will change to 9 (correct, 9 should be visible from the begining as it's defined in
responsiveOptions
).Walkaround
I case if anyone had the same problem, here is walkaround - delay
calculatePosition
, to be executed when whole html is initialized, so it can enter intoif
which contains whole function's body (and what's most important in this case - recalculatenumVisible
).What is the motivation / use case for changing the behavior?
Carousel should be correctly initialized with data matching current resolution, not using default values provided in html.
All browsers, tested on Chrome 81 and FF.
The text was updated successfully, but these errors were encountered: