git_sitools_idoc / flarecast / workspace / client-public-3.0 / js / ux / slider / SliderRange.js @ master
1 |
// create namespace for plugins
|
---|---|
2 |
Ext.namespace('Ext.ux.plugins');
|
3 |
|
4 |
/**
|
5 |
* Ext.ux.plugins.SliderRange plugin for Ext.Slider
|
6 |
* Overrided by Sitools team to be compatible with Extjs4.2
|
7 |
*
|
8 |
* @author Dorothea Loew
|
9 |
* @date Februar 15, 2009
|
10 |
*
|
11 |
* @class Ext.ux.plugins.SliderRange
|
12 |
* @extends Ext.util.Observable
|
13 |
*/
|
14 |
|
15 |
Ext.ux.plugins.SliderRange = function(config) { |
16 |
Ext.apply(this, config);
|
17 |
}; |
18 |
|
19 |
// plugin code
|
20 |
Ext.define('Ext.ux.slider.SliderRange', {
|
21 |
extend : 'Ext.AbstractPlugin', |
22 |
init:function(slider) { |
23 |
Ext.apply(slider, { |
24 |
onResize:Ext.Function.createSequence(slider.onResize, function(ct, position) { |
25 |
|
26 |
// slider needs more space with range: height="50px"
|
27 |
this.el.addCls('ux-sliderrange-slider'); |
28 |
|
29 |
|
30 |
if (slider.range) {
|
31 |
slider.range.remove(); |
32 |
} |
33 |
|
34 |
// create range-object, width from sliders-element
|
35 |
slider.range = slider.bodyEl.down(".x-slider-end").createChild({cls: 'ux-sliderrange'}); |
36 |
|
37 |
// create one child per value and show value in html-config
|
38 |
for (var i = slider.minValue; i <= slider.maxValue; i = i + slider.increment) { |
39 |
var position = slider.calculateThumbPosition(i);
|
40 |
|
41 |
slider.range.createChild({ |
42 |
html : '' + i, |
43 |
cls : 'ux-sliderrange-val', |
44 |
style : 'left: ' + position + '%;' |
45 |
}); |
46 |
} |
47 |
|
48 |
|
49 |
}) // end of function afterRender
|
50 |
}); |
51 |
} // end of function init
|
52 |
}); // end of extend
|