PDA

View Full Version : Slider increment of less than 1



andytriboletti
7 Nov 2013, 3:09 PM
I want to have a slider with a value of 95 to 100 with an increment of .01. I tried with this code, but the increment is 1. Also the field label doesn't show up. Does anyone know how to fix these problems?



Ext.create('Ext.slider.Single', {
fieldLabel: 'Similarity Threshold',
renderTo: Ext.getBody(),
width: 214,
minValue: 95,
hideLabel: true,
useTips: false,
maxValue: 100,
increment: 0.01,
useTips: true
});

burnnat
8 Nov 2013, 9:46 AM
You have two problems. First, the field label isn't showing up because you have hideLabel (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.slider.Single-cfg-hideLabel) set to "true". Second, to round to two decimal places rather than the nearest integer, you need to set decimalPrecision (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.slider.Single-cfg-decimalPrecision) to 2. Here's what it looks like with these things fixed:

1f2