Slider: Issues with Step configuration (calculation)
See original GitHub issueDescribe the defect As I already wrote in the forum (https://forum.primefaces.org/viewtopic.php?f=3&t=71799) I think there is a little bug in the step configuration or calculation of the slider element.
For my point of view the calculation of the steps is done based on the min value instead of zero base. If you have a min value of 800 the next step is 1300 (800+500), I would expect 1000 (0 + 500 + 500). Also when the max value isn’t a value of the min value, you can not reach it. My example here is 15000 end value of the Slider with it is 14800.
Reproducer Reproducer is attached to the ticket, code sniped:
@PostConstruct
public void init() {
integer = 3000;
}
<h:form id="frmTest">
<h:panelGrid columns="1" style="margin-bottom: 10px">
<p:inputText id="number" value="#{testView.integer}" />
<p:slider for="number" minValue="800" maxValue="15000" step="500" />
</h:panelGrid>
</h:form>
Environment:
- PF Version: 11.0.0
- JSF + version: _e.g. Mojarra 2.2.20
- Affected browsers: my test is based on Chrome, but I think all
Expected behavior My expected behavior is, that the calculation is based on zero and the first and the last point are calculated individual.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
@melloware, I’m right now on it to perform a couple of tests. During that, I notice that you fix with it, also an issue in the showcase.
https://www.primefaces.org/showcase/ui/input/slider.xhtml
InputText Slider with Decimal Value -> Range defined from 0.2 -> 7.1 In the showcase application 7.1 is not reachable.
I added it to pf-8619 and it works:
Thanks for the fix. I will take a look into it on Monday. Over the Weekend i have no time for it, sorry.