Reputation: 5187
I am using JSF 2.2
, Primefaces 4.0
, and I am using slider
component from Primefaces
.
<p:slider displayTemplate="Between {min} and {max}" minValue="20" maxValue="40" step="1"/>
I would like to ask you if is possibile to have step
as decimal
value. E.g. step="0.1"
, or perhaps some ideas about how to solve this issue.
I have tried but I'm getting errors like :
javax.el.ELException: Cannot convert 0.1 of type class java.lang.String to int] with root cause
Thank you.
Upvotes: 4
Views: 4108
Reputation: 2967
As most of the primefaces widgets are based on Jquery UI Widgets,so remove step
attribute from <p:slider>
and pass it with Jquery
<p:slider id="slder" displayTemplate="Between {min} and {max}" minValue="20"
maxValue="40" />
Script to manipulate this
$(window).load(function(){ // should be $(window).load to load widget
$('#slder').slider({
step: 0.1
});
});
NOTE : This trick works for any Primefaces widget which is based on Jquery UI widget
Upvotes: 5