]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/kitchensink/classic/samples/view/form/SliderField.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / kitchensink / classic / samples / view / form / SliderField.js
CommitLineData
6527f429
DM
1/**\r
2 * Shows how the Slider control can be used in a form and participate like a form field.\r
3 */\r
4Ext.define('KitchenSink.view.form.SliderField', {\r
5 extend: 'Ext.form.Panel',\r
6 \r
7 requires: [\r
8 'Ext.slider.Single'\r
9 ],\r
10 xtype: 'slider-field',\r
11 //<example>\r
12 exampleTitle: 'Slider field example',\r
13 profiles: {\r
14 classic: {\r
15 labelWidth: 125\r
16 },\r
17 neptune: {\r
18 labelWidth: 125\r
19 },\r
20 'neptune-touch': {\r
21 labelWidth: 150\r
22 }\r
23 },\r
24 //</example>\r
25 \r
26 width: 400,\r
27 title: 'Sound Settings',\r
28 bodyPadding: 10,\r
29 \r
30 initComponent: function(){\r
31 this.msgTpl = new Ext.Template(\r
32 'Sounds Effects: <b>{fx}%</b><br />',\r
33 'Ambient Sounds: <b>{ambient}%</b><br />',\r
34 'Interface Sounds: <b>{iface}%</b>'\r
35 );\r
36 Ext.apply(this, {\r
37 defaults: {\r
38 labelWidth: this.profileInfo.labelWidth,\r
39 anchor: '95%',\r
40 tipText: function(thumb){\r
41 return String(thumb.value) + '%';\r
42 } \r
43 },\r
44 defaultType: 'slider',\r
45 items: [{\r
46 fieldLabel: 'Sound Effects',\r
47 value: 50,\r
48 name: 'fx'\r
49 },{\r
50 fieldLabel: 'Ambient Sounds',\r
51 value: 80,\r
52 name: 'ambient'\r
53 },{\r
54 fieldLabel: 'Interface Sounds',\r
55 value: 25,\r
56 name: 'iface'\r
57 }],\r
58 bbar: [{\r
59 text: 'Max All',\r
60 scope: this,\r
61 handler: this.onMaxAllClick\r
62 }, '->', {\r
63 text: 'Save',\r
64 scope: this,\r
65 handler: this.onSaveClick\r
66 }, {\r
67 text: 'Reset',\r
68 scope: this,\r
69 handler: this.onResetClick\r
70 }]\r
71 });\r
72 this.callParent();\r
73 },\r
74 \r
75 onMaxAllClick: function(){\r
76 Ext.suspendLayouts();\r
77 this.items.each(function(c){\r
78 c.setValue(100);\r
79 });\r
80 Ext.resumeLayouts(true);\r
81 },\r
82 \r
83 onSaveClick: function(){\r
84 Ext.Msg.alert({\r
85 title: 'Settings Saved',\r
86 msg: this.msgTpl.apply(this.getForm().getValues()),\r
87 icon: Ext.Msg.INFO,\r
88 buttons: Ext.Msg.OK\r
89 }); \r
90 },\r
91 \r
92 onResetClick: function(){\r
93 this.getForm().reset();\r
94 }\r
95});\r