]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/form/RatingForm.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / form / RatingForm.js
CommitLineData
6527f429
DM
1/**\r
2 * Demonstrates the rating widget in a form and grid column.\r
3 */\r
4Ext.define('KitchenSink.view.form.RatingForm', {\r
5 extend: 'Ext.panel.Panel',\r
6 xtype: 'form-rating',\r
7\r
8 requires: [\r
9 'Ext.ux.rating.Picker'\r
10 ],\r
11 //<example>\r
12 exampleTitle: 'Rating Form',\r
13 otherContent: [{\r
14 type: 'Store',\r
15 path: 'classic/samples/store/BigData.js'\r
16 }, {\r
17 type: 'Model',\r
18 path: 'classic/samples/model/grid/Employee.js'\r
19 }],\r
20 //</example>\r
21 \r
22 title: 'Rating Form',\r
23 viewModel: true,\r
24\r
25 bodyPadding: 10,\r
26 width: 520,\r
27 height: 500,\r
28 minHeight: 400,\r
29 resizable: true,\r
30 frame: true,\r
31 layout: {\r
32 type: 'vbox',\r
33 align: 'stretch'\r
34 },\r
35 defaultType: 'textfield',\r
36\r
37 items: [{\r
38 xtype: 'grid',\r
39 flex: 1,\r
40 reference: 'employeeGrid',\r
41 store: {\r
42 type: 'big-data'\r
43 },\r
44 margin: '0 0 10 0',\r
45 columns:[{\r
46 xtype: 'rownumberer',\r
47 width: 40,\r
48 sortable: false\r
49 }, {\r
50 text: 'Id',\r
51 sortable: true,\r
52 dataIndex: 'employeeNo',\r
53 groupable: false,\r
54 width: 80\r
55 }, {\r
56 text: 'Name',\r
57 sortable: true,\r
58 dataIndex: 'name',\r
59 groupable: false,\r
60 flex: 1\r
61 },{\r
62 text: 'Rating',\r
63 columns: [{\r
64 xtype: 'widgetcolumn',\r
65 text: 'Last Year',\r
66 width: 100,\r
67 dataIndex: 'ratingLastYear',\r
68 widget: {\r
69 xtype: 'rating',\r
70 overStyle: 'color: orange;'\r
71 }\r
72 },{\r
73 xtype: 'widgetcolumn',\r
74 text: 'This Year',\r
75 width: 100,\r
76 dataIndex: 'ratingThisYear',\r
77 widget: {\r
78 xtype: 'rating',\r
79 selectedStyle: 'color: rgb(96, 169, 23);',\r
80 overStyle: 'color: rgb(23, 23, 189);',\r
81 tooltip: [\r
82 '<div style="white-space: nowrap;"><b>',\r
83 'Current: {[this.rank[values.value]]}',\r
84 '</b>',\r
85 '<tpl if="trackOver && tracking !== value">',\r
86 '<br><span style="color:#aaa">(click to set to ',\r
87 '{[this.rank[values.tracking]]}',\r
88 ')</span>',\r
89 '</tpl></span>',\r
90 {\r
91 rank: {\r
92 1: 'Probation',\r
93 2: 'Needs Improvement',\r
94 3: 'Valued Contributor',\r
95 4: 'Excellent',\r
96 5: 'Rock Star'\r
97 }\r
98 }\r
99 ]\r
100 }\r
101 }]\r
102 }]\r
103 },{\r
104 fieldLabel: 'First Name',\r
105 emptyText: 'First Name',\r
106 bind: {\r
107 disabled: '{!employeeGrid.selection}',\r
108 value: '{employeeGrid.selection.forename}'\r
109 }\r
110 }, {\r
111 fieldLabel: 'Last Name',\r
112 emptyText: 'Last Name',\r
113 bind: {\r
114 disabled: '{!employeeGrid.selection}',\r
115 value: '{employeeGrid.selection.surname}'\r
116 }\r
117 }, {\r
118 fieldLabel: 'Email',\r
119 vtype: 'email',\r
120 bind: {\r
121 disabled: '{!employeeGrid.selection}',\r
122 value: '{employeeGrid.selection.email}'\r
123 }\r
124 }, {\r
125 xtype: 'datefield',\r
126 fieldLabel: 'Date of Birth',\r
127 allowBlank: false,\r
128 maxValue: new Date(),\r
129 bind: {\r
130 disabled: '{!employeeGrid.selection}',\r
131 value: '{employeeGrid.selection.dob}'\r
132 }\r
133 }, {\r
134 xtype: 'fieldcontainer',\r
135 fieldLabel: 'Current\u00a0Rating',\r
136 bind: {\r
137 disabled: '{!employeeGrid.selection}'\r
138 },\r
139 items: [{\r
140 xtype: 'rating',\r
141 scale: '150%',\r
142 bind: '{employeeGrid.selection.ratingThisYear}'\r
143 }]\r
144 }]\r
145});\r