]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/classic/dd/cell-to-cell-dd.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / classic / dd / cell-to-cell-dd.js
CommitLineData
6527f429
DM
1Ext.require('Ext.ux.CellDragDrop');\r
2Ext.onReady(function () {\r
3 var myData = [\r
4 ['3m Co', '1/1 12:00am', 71.72, 'Up', 0.02, 0.03, '9/1 12:00am'],\r
5 ['Alcoa Inc', '1/1 12:00am', 29.01, 'Up', 0.42, 1.47, '9/1 12:00am'],\r
6 ['Altria Group Inc', '1/1 12:00am', 83.81, 'Up', 0.28, 0.34, '9/1 12:00am'],\r
7 ['American Express Company', '1/1 12:00am', 52.55, 'Up', 0.01, 0.02, '9/1 12:00am'],\r
8 ['American International Group, Inc.', '1/1 12:00am', 64.13, 'Up', 0.31, 0.49, '9/1 12:00am'],\r
9 ['AT&T Inc.', '1/1 12:00am', 31.61, 'Down', -0.48, -1.54, '9/1 12:00am'],\r
10 ['Boeing Co.', '1/1 12:00am', 75.43, 'Up', 0.53, 0.71, '9/1 12:00am'],\r
11 ['Caterpillar Inc.', '1/1 12:00am', 67.27, 'Up', 0.92, 1.39, '9/1 12:00am'],\r
12 ['Citigroup, Inc.', '1/1 12:00am', 49.37, 'Up', 0.02, 0.04, '9/1 12:00am'],\r
13 ['E.I. du Pont de Nemours and Company', '1/1 12:00am', 40.48, 'Up', 0.51, 1.28, '9/1 12:00am'],\r
14 ['Exxon Mobil Corp', '1/1 12:00am', 68.1, 'Down', -0.43, -0.64, '9/1 12:00am'],\r
15 ['General Electric Company', '1/1 12:00am', 34.14, 'Down', -0.08, -0.23, '9/1 12:00am'],\r
16 ['General Motors Corporation', '1/1 12:00am', 30.27, 'Up', 1.09, 3.74, '9/1 12:00am'],\r
17 ['Hewlett-Packard Co.', '1/1 12:00am', 36.53, 'Down', -0.03, -0.08, '9/1 12:00am'],\r
18 ['Honeywell Intl Inc', '1/1 12:00am', 38.77, 'Up', 0.05, 0.13, '9/1 12:00am'],\r
19 ['Intel Corporation', '1/1 12:00am', 19.88, 'Up', 0.31, 1.58, '9/1 12:00am'],\r
20 ['International Business Machines', '1/1 12:00am', 81.41,'Up', 0.44, 0.54, '9/1 12:00am'],\r
21 ['Johnson & Johnson', '1/1 12:00am', 64.72, 'Up', 0.06, 0.09, '9/1 12:00am'],\r
22 ['JP Morgan & Chase & Co', '1/1 12:00am', 45.73, 'Up', 0.07, 0.15, '9/1 12:00am'],\r
23 ['McDonald\'s Corporation', '1/1 12:00am', 36.76, 'Up', 0.86, 2.40, '9/1 12:00am'],\r
24 ['Merck & Co., Inc.', '1/1 12:00am', 40.96, 'Up', 0.41, 1.01, '9/1 12:00am'],\r
25 ['Microsoft Corporation', '1/1 12:00am', 25.84, 'Up', 0.14, 0.54, '9/1 12:00am'],\r
26 ['Pfizer Inc', '1/1 12:00am', 27.96, 'Up', 0.4, 1.45, '9/1 12:00am'],\r
27 ['The Coca-Cola Company', '1/1 12:00am', 45.07, 'Up', 0.26, 0.58, '9/1 12:00am'],\r
28 ['The Home Depot, Inc.', '1/1 12:00am', 34.64, 'Up', 0.35, 1.02, '9/1 12:00am'],\r
29 ['The Procter & Gamble Company', '1/1 12:00am', 61.91, 'Up', 0.01, 0.02, '9/1 12:00am'],\r
30 ['United Technologies Corporation', '1/1 12:00am', 63.26, 'Up', 0.55, 0.88, '9/1 12:00am'],\r
31 ['Verizon Communications', '1/1 12:00am', 35.57, 'Up', 0.39, 1.11, '9/1 12:00am'],\r
32 ['Wal-Mart Stores, Inc.', '1/1 12:00am', 45.45, 'Up', 0.73, 1.63, '9/1 12:00am']\r
33 ];\r
34\r
35 var store = Ext.create('Ext.data.ArrayStore', {\r
36 fields: [{\r
37 name: 'company'\r
38 }, {\r
39 name: 'firstChange',\r
40 type: 'date',\r
41 dateFormat: 'n/j h:ia'\r
42 }, {\r
43 name: 'price',\r
44 type: 'float'\r
45 }, {\r
46 name: 'stock'\r
47 }, {\r
48 name: 'change',\r
49 type: 'float'\r
50 }, {\r
51 name: 'pctChange',\r
52 type: 'float'\r
53 }, {\r
54 name: 'lastChange',\r
55 type: 'date',\r
56 dateFormat: 'n/j h:ia'\r
57 }],\r
58 data: myData\r
59 });\r
60\r
61 Ext.create('Ext.grid.Panel', {\r
62 frame: true,\r
63 title: 'Drag cell data test',\r
64 store: store,\r
65 columns: [{\r
66 id: 'company',\r
67 header: "Company",\r
68 flex:1,\r
69 sortable: true,\r
70 dataIndex: 'company'\r
71 }, {\r
72 xtype: 'datecolumn',\r
73 header: "First Updated",\r
74 width: 128,\r
75 sortable: true,\r
76 dataIndex: 'firstChange'\r
77 }, {\r
78 header: "Price",\r
79 width: 75,\r
80 sortable: true,\r
81 dataIndex: 'price'\r
82 }, {\r
83 header: "Stock",\r
84 width: 75,\r
85 sortable: true,\r
86 dataIndex: 'stock'\r
87 }, {\r
88 header: "Change",\r
89 width: 85,\r
90 sortable: true,\r
91 dataIndex: 'change'\r
92 }, {\r
93 header: "% Change",\r
94 width: 106,\r
95 sortable: true,\r
96 dataIndex: 'pctChange'\r
97 }, {\r
98 xtype: 'datecolumn',\r
99 header: "Last Updated",\r
100 width: 130,\r
101 sortable: true,\r
102 dataIndex: 'lastChange'\r
103 }],\r
104 viewConfig: {\r
105 plugins: {\r
106 ptype: 'celldragdrop',\r
107 // remove text from source cell and replace with value of emptyText\r
108 applyEmptyText: true,\r
109 dropBackgroundColor: Ext.themeName === 'neptune' ? '#a4ce6c' : 'green',\r
110 noDropBackgroundColor: Ext.themeName === 'neptune' ? '#d86f5d' : 'red',\r
111 //emptyText: Ext.String.htmlEncode('<<foo>>'),\r
112\r
113 // will only allow drops of the same type\r
114 enforceType: true\r
115 }\r
116 },\r
117 height: 400,\r
118 width: 880,\r
119 renderTo: Ext.getBody()\r
120 });\r
121});\r