]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | Ext.define('KitchenSink.view.grid.FramingButtons', {\r |
2 | extend: 'Ext.grid.Panel',\r | |
3 | \r | |
4 | xtype: 'framing-buttons',\r | |
5 | store: 'Companies',\r | |
6 | \r | |
7 | columns: [\r | |
8 | {text: "Company", flex: 1, sortable: true, dataIndex: 'name'},\r | |
9 | {text: "Price", width: 120, sortable: true, formatter: 'usMoney', dataIndex: 'price'},\r | |
10 | {text: "Change", width: 120, sortable: true, dataIndex: 'change'},\r | |
11 | {text: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},\r | |
12 | {text: "Last Updated", width: 120, sortable: true, formatter: 'date("m/d/Y")', dataIndex: 'lastChange'}\r | |
13 | ],\r | |
14 | columnLines: true,\r | |
15 | selModel: {\r | |
16 | type: 'checkboxmodel',\r | |
17 | listeners: {\r | |
18 | selectionchange: 'onSelectionChange'\r | |
19 | }\r | |
20 | },\r | |
21 | \r | |
22 | // This view acts as the default listener scope for listeners declared within it.\r | |
23 | // For example the selectionModel's selectionchange listener resolves to this.\r | |
24 | defaultListenerScope: true,\r | |
25 | \r | |
26 | // This view acts as a reference holder for all components below it which have a reference config\r | |
27 | // For example the onSelectionChange listener accesses a button using its reference\r | |
28 | referenceHolder: true,\r | |
29 | \r | |
30 | onSelectionChange: function(sm, selections) {\r | |
31 | this.getReferences().removeButton.setDisabled(selections.length === 0);\r | |
32 | },\r | |
33 | \r | |
34 | // inline buttons\r | |
35 | dockedItems: [{\r | |
36 | xtype: 'toolbar',\r | |
37 | dock: 'bottom',\r | |
38 | ui: 'footer',\r | |
39 | layout: {\r | |
40 | pack: 'center'\r | |
41 | },\r | |
42 | items: [{\r | |
43 | minWidth: 80,\r | |
44 | text: 'Save'\r | |
45 | },{\r | |
46 | minWidth: 80,\r | |
47 | text: 'Cancel'\r | |
48 | }]\r | |
49 | }, {\r | |
50 | xtype: 'toolbar',\r | |
51 | items: [{\r | |
52 | text: 'Add Something',\r | |
53 | tooltip: 'Add a new row',\r | |
54 | iconCls: 'framing-buttons-add'\r | |
55 | }, '-', {\r | |
56 | text: 'Options',\r | |
57 | tooltip: 'Set options',\r | |
58 | iconCls: 'framing-buttons-option'\r | |
59 | },'-',{\r | |
60 | reference: 'removeButton', // The referenceHolder can access this button by this name\r | |
61 | text: 'Remove Something',\r | |
62 | tooltip: 'Remove the selected item',\r | |
63 | iconCls:'framing-buttons-remove',\r | |
64 | disabled: true\r | |
65 | }]\r | |
66 | }],\r | |
67 | \r | |
68 | height: 300,\r | |
69 | frame: true,\r | |
70 | title: 'Support for standard Panel features such as framing, buttons and toolbars',\r | |
71 | iconCls: 'framing-buttons-grid',\r | |
72 | //<example>\r | |
73 | exampleTitle: 'Support for standard Panel features such as framing, buttons and toolbars',\r | |
74 | otherContent: [{\r | |
75 | type: 'Store',\r | |
76 | path: 'classic/samples/store/Companies.js'\r | |
77 | }, {\r | |
78 | type: 'Model',\r | |
79 | path: 'classic/samples/model/Company.js'\r | |
80 | }],\r | |
81 | profiles: {\r | |
82 | classic: {\r | |
83 | width: 700\r | |
84 | },\r | |
85 | neptune: {\r | |
86 | width: 750\r | |
87 | }\r | |
88 | },\r | |
89 | //</example>\r | |
90 | \r | |
91 | initComponent: function() {\r | |
92 | this.width = this.profileInfo.width;\r | |
93 | this.callParent();\r | |
94 | }\r | |
95 | }); |