]> git.proxmox.com Git - extjs.git/blame - extjs/examples/kitchensink/classic/samples/view/grid/RowExpander.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / kitchensink / classic / samples / view / grid / RowExpander.js
CommitLineData
6527f429
DM
1/**\r
2 * This is an example of using the grid with a RowExpander plugin that adds the ability\r
3 * to have a column in a grid which enables a second row body which expands/contracts.\r
4 *\r
5 * The expand/contract behavior is configurable to react on clicking of the column, double\r
6 * click of the row, and/or hitting enter while a row is selected.\r
7 */\r
8Ext.define('KitchenSink.view.grid.RowExpander', {\r
9 extend: 'Ext.grid.Panel',\r
10\r
11 xtype: 'row-expander-grid',\r
12 store: 'Companies',\r
13\r
14 columns: [\r
15 { text: "Company", flex: 1, dataIndex: 'name'},\r
16 { text: "Price", formatter: 'usMoney', dataIndex: 'price'},\r
17 { text: "Change", dataIndex: 'change'},\r
18 { text: "% Change", dataIndex: 'pctChange'},\r
19 { text: "Last Updated", formatter: 'date("m/d/Y")', dataIndex: 'lastChange'}\r
20 ],\r
21 width: 600,\r
22 height: 300,\r
23\r
24 //<example>\r
25 otherContent: [{\r
26 type: 'Store',\r
27 path: 'classic/samples/store/Companies.js'\r
28 },{\r
29 type: 'Model',\r
30 path: 'classic/samples/model/Company.js'\r
31 }],\r
32 //</example>\r
33\r
34 plugins: [{\r
35 ptype: 'rowexpander',\r
36 rowBodyTpl : new Ext.XTemplate(\r
37 '<p><b>Company:</b> {name}</p>',\r
38 '<p><b>Change:</b> {change:this.formatChange}</p>',\r
39 {\r
40 formatChange: function(v){\r
41 var color = v >= 0 ? 'green' : 'red';\r
42 return '<span style="color: ' + color + ';">' + Ext.util.Format.usMoney(v) + '</span>';\r
43 }\r
44 })\r
45 }],\r
46 title: 'Expander Rows to show extra data'\r
47});\r