]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('KitchenSink.view.binding.Form', {\r |
2 | extend: 'Ext.form.Panel',\r | |
3 | \r | |
4 | //<example>\r | |
5 | requires: [\r | |
6 | 'Ext.app.ViewModel'\r | |
7 | ],\r | |
8 | //</example>\r | |
9 | \r | |
10 | viewModel: {\r | |
11 | data: {\r | |
12 | red: 255,\r | |
13 | green: 100,\r | |
14 | blue: 150\r | |
15 | }\r | |
16 | },\r | |
17 | \r | |
18 | layout: 'vbox',\r | |
19 | scrollable: true,\r | |
20 | \r | |
21 | items: {\r | |
22 | xtype: 'fieldset',\r | |
23 | flex: 1,\r | |
24 | minHeight: 400,\r | |
25 | defaultType: 'container',\r | |
26 | layout: 'vbox',\r | |
27 | instructions: [\r | |
28 | 'The style of the color block is controlled by either the numeric ',\r | |
29 | 'field or the slider. Both the numeric fields and the slider are bound to ',\r | |
30 | 'the same value in the View Model.'\r | |
31 | ].join(''),\r | |
32 | items: [{\r | |
33 | layout: 'hbox',\r | |
34 | defaults: {\r | |
35 | maxValue: 255,\r | |
36 | minValue: 0\r | |
37 | },\r | |
38 | items: [{\r | |
39 | xtype: 'numberfield',\r | |
40 | label: 'Red',\r | |
41 | labelWidth: '50%',\r | |
42 | width: 150,\r | |
43 | bind: '{red}'\r | |
44 | }, {\r | |
45 | xtype: 'singlesliderfield',\r | |
46 | flex: 1,\r | |
47 | bind: '{red}',\r | |
48 | liveUpdate: true\r | |
49 | }]\r | |
50 | }, {\r | |
51 | layout: 'hbox',\r | |
52 | defaults: {\r | |
53 | maxValue: 255,\r | |
54 | minValue: 0\r | |
55 | },\r | |
56 | items: [{\r | |
57 | xtype: 'numberfield',\r | |
58 | label: 'Green',\r | |
59 | labelWidth: '50%',\r | |
60 | width: 150,\r | |
61 | bind: '{green}'\r | |
62 | }, {\r | |
63 | xtype: 'singlesliderfield',\r | |
64 | flex: 1,\r | |
65 | bind: '{green}',\r | |
66 | liveUpdate: true\r | |
67 | }]\r | |
68 | }, {\r | |
69 | layout: 'hbox',\r | |
70 | defaults: {\r | |
71 | maxValue: 255,\r | |
72 | minValue: 0\r | |
73 | },\r | |
74 | items: [{\r | |
75 | xtype: 'numberfield',\r | |
76 | label: 'Blue',\r | |
77 | labelWidth: '50%',\r | |
78 | width: 150,\r | |
79 | bind: '{blue}'\r | |
80 | }, {\r | |
81 | xtype: 'singlesliderfield',\r | |
82 | flex: 1,\r | |
83 | bind: '{blue}',\r | |
84 | liveUpdate: true\r | |
85 | }]\r | |
86 | }, {\r | |
87 | xtype: 'component',\r | |
88 | flex: 1,\r | |
89 | bind: {\r | |
90 | style: {\r | |
91 | backgroundColor: 'rgba({red}, {green}, {blue}, 1)'\r | |
92 | }\r | |
93 | }\r | |
94 | }]\r | |
95 | }\r | |
96 | });\r |