]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/grid/XmlGrid.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / grid / XmlGrid.js
CommitLineData
6527f429
DM
1/**\r
2 * This example shows how to create a grid from XML data. The grid is stateful so you can\r
3 * move or hide columns, reload the page, and come back to the grid in the same state you\r
4 * left it in.\r
5 *\r
6 * The cells are selectable due to use of the `enableTextSelection` option.\r
7 */\r
8Ext.define('KitchenSink.view.grid.XmlGrid', {\r
9 extend: 'Ext.grid.Panel',\r
10 requires: [\r
11 'Ext.grid.column.Column',\r
12 'KitchenSink.store.Books'\r
13 ],\r
14 xtype: 'xml-grid',\r
15 store: {\r
16 type: 'books'\r
17 },\r
18 stateful: true,\r
19 collapsible: true,\r
20 multiSelect: true,\r
21 stateId: 'stateXmlGrid',\r
22 height: 350,\r
23 title: 'XML Grid',\r
24 viewConfig: {\r
25 enableTextSelection: true\r
26 },\r
27 //<example>\r
28 otherContent: [{\r
29 type: 'Store',\r
30 path: 'classic/samples/store/Books.js'\r
31 },{\r
32 type: 'Model',\r
33 path: 'classic/samples/model/grid/Book.js'\r
34 }],\r
35 profiles: {\r
36 classic: {\r
37 width: 600,\r
38 percentChangeColumnWidth: 75,\r
39 lastUpdatedColumnWidth: 85,\r
40 green: 'green',\r
41 red: 'red'\r
42 },\r
43 neptune: {\r
44 width: 650,\r
45 percentChangeColumnWidth: 100,\r
46 lastUpdatedColumnWidth: 115,\r
47 green: '#73b51e',\r
48 red: '#cf4c35'\r
49 }\r
50 },\r
51 //</example>\r
52\r
53 initComponent: function () {\r
54 var me = this;\r
55\r
56 me.width = this.profileInfo.width;\r
57 me.columns = [\r
58 {text: "Author", flex: 1, dataIndex: 'Author'},\r
59 {text: "Title", width: 180, dataIndex: 'Title'},\r
60 {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer'},\r
61 {text: "Product Group", width: 100, dataIndex: 'ProductGroup'}\r
62 ];\r
63\r
64 me.callParent();\r
65\r
66 this.on('afterlayout', this.loadStore, this, {\r
67 delay: 1,\r
68 single: true\r
69 });\r
70 },\r
71\r
72 loadStore: function() {\r
73 this.getStore().load();\r
74 }\r
75});