-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider.js
72 lines (69 loc) · 2.01 KB
/
slider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
define(["qlik"], function(qlik/*, props, initProps*/) {
return {
//initialProperties : initProps,
initialProperties : {
version : 1.0,
variableValue : {},
variableName : "",
initialValue : 0
},
definition : {
type : "items",
component : "accordion",
items : {
settings : {
uses : "settings",
items : { // Propiedades
variable : {
type : "items",
label : "Parámetros",
items : {
name : {
ref : "variableName",
label : "Nombre de variable a usar",
type : "string",
change : function(data) {
// creación de la variable
qlik.currApp().variable.create(data.variableName);
data.variableValue.qStringExpression = '=' + data.variableName;
qlik.currApp(this).variable.setContent(data.variableName, data.initialValue);
}
},
limitInf : {
ref: "props.limitInf",
label: "Valor Mínimo",
type: "number",
expression: "optional",
defaultValue: -10
},
limitSup : {
ref: "props.limitSup",
label: "Valor Máximo",
type: "number",
expression: "optional",
defaultValue: 10
},
sliderStep : {
ref: "props.sliderStep",
label: "Incremento Estático",
type: "number",
expression: "optional",
defaultValue: 0.5
}
}
}
}
}
}
},
paint : function($element, layout) {
var html = "", ext = this;
html += '<input type="range" min="' + layout.props.limitInf + '" max="' + layout.props.limitSup + '" step="' + layout.props.sliderStep + '" style="width:98%" value="' + layout.variableValue + '"/>';
$element.html(html);
$element.find('input').on('change', function() {
var val = $(this).val() + '';
qlik.currApp(ext).variable.setContent(layout.variableName, val);
})
}
};
});