]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/binding/TwoWay.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / binding / TwoWay.js
CommitLineData
6527f429
DM
1/**\r
2 * This example shows simple two way data binding. When the value is changed by the user\r
3 * in the field, the change is reflected in the panel title. Similarly, when the value is\r
4 * changed in the view model, the same change is reflected in the text field.\r
5 */\r
6Ext.define('KitchenSink.view.binding.TwoWay', {\r
7 extend: 'Ext.panel.Panel',\r
8 alias: 'widget.binding-two-way',\r
9\r
10 //<example>\r
11 requires: ['KitchenSink.view.binding.TwoWayController'],\r
12 otherContent: [{\r
13 type: 'ViewController',\r
14 path: 'classic/samples/view/binding/TwoWayController.js'\r
15 }],\r
16 //</example>\r
17\r
18 width: 300,\r
19 bodyPadding: 10,\r
20\r
21 controller: 'binding.twoway',\r
22 viewModel: {\r
23 data: {\r
24 title: 'The title'\r
25 }\r
26 },\r
27\r
28 bind: {\r
29 title: '{title}'\r
30 },\r
31\r
32 items: {\r
33 xtype: 'textfield',\r
34 fieldLabel: 'Title',\r
35 labelWidth: 50,\r
36 // The default config for textfield in a bind is "value" (two-way):\r
37 bind: '{title}'\r
38 },\r
39\r
40 tbar: [{\r
41 text: 'Random Title',\r
42 handler: 'onTitleButtonClick'\r
43 }]\r
44});