Mercurial > lada > lada-client
comparison app/view/grid/Status.js @ 945:023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
To enable the uses of StatusWerte, the controller for the status grid, needed to be extended.
In addition, the form and grid views of Messung and Status were updated.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 27 Oct 2015 16:46:58 +0100 |
parents | 1f1467713c3f |
children | c7bf0b459074 |
comparison
equal
deleted
inserted
replaced
944:1f1467713c3f | 945:023e622f9551 |
---|---|
26 | 26 |
27 initComponent: function() { | 27 initComponent: function() { |
28 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { | 28 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { |
29 clicksToMoveEditor: 1, | 29 clicksToMoveEditor: 1, |
30 autoCancel: false, | 30 autoCancel: false, |
31 disabled: false, | 31 disabled: true, |
32 pluginId: 'rowedit', | 32 pluginId: 'rowedit', |
33 listeners:{ | 33 listeners:{ |
34 // Make row ineditable when readonly is set to true | 34 // Make row ineditable when readonly is set to true |
35 // Normally this would belong into a controller an not the view. | 35 // Normally this would belong into a controller an not the view. |
36 // But the RowEditPlugin is not handled there. | 36 // But the RowEditPlugin is not handled there. |
37 beforeedit: function(e, o) { | 37 beforeedit: function(e, o) { |
38 var readonlywin = o.grid.up('window').record.get('readonly'); | 38 var readonlywin = o.grid.up('window').record.get('readonly'); |
39 var readonlygrid = o.record.get('readonly'); | 39 var readonlygrid = o.record.get('readonly'); |
40 if (readonlywin == true || readonlygrid == true || this.disabled) { | 40 if (readonlywin == true || readonlygrid == true || this.disabled) { |
41 return false; | 41 return false; |
42 } | 42 } |
43 return true; | 43 return true; |
44 } | 44 } |
45 } | 45 } |
46 }); | 46 }); |
47 this.plugins = [this.rowEditing]; | 47 this.plugins = [this.rowEditing]; |
48 | 48 |
49 var statusStore = Ext.create('Lada.store.StatusWerte'); | 49 var statusStore = Ext.create('Lada.store.StatusWerte'); |
50 statusStore.load(); | |
50 this.dockedItems = [{ | 51 this.dockedItems = [{ |
51 xtype: 'toolbar', | 52 xtype: 'toolbar', |
52 dock: 'bottom', | 53 dock: 'bottom', |
53 items: ['->', { | 54 items: ['->', { |
54 text: 'Hinzufügen', | 55 text: 'Hinzufügen', |
62 action: 'delete' | 63 action: 'delete' |
63 }] | 64 }] |
64 }]; | 65 }]; |
65 this.columns = [{ | 66 this.columns = [{ |
66 header: 'erstellt', | 67 header: 'erstellt', |
67 dataIndex: 'sdatum', | 68 dataIndex: 'datum', |
68 xtype: 'datecolumn', | 69 xtype: 'datecolumn', |
69 format: 'd.m.Y H:i', | 70 format: 'd.m.Y H:i', |
70 width: 110, | 71 width: 110, |
72 sortable: false, | |
71 }, { | 73 }, { |
72 header: 'Erzeuger', | 74 header: 'Erzeuger', |
73 dataIndex: 'erzeuger', | 75 dataIndex: 'erzeuger', |
74 renderer: function(value) { | 76 renderer: function(value) { |
75 if (!value || value === '') { | 77 if (!value || value === '') { |
83 store: Ext.data.StoreManager.get('messstellen'), | 85 store: Ext.data.StoreManager.get('messstellen'), |
84 displayField: 'messStelle', | 86 displayField: 'messStelle', |
85 valueField: 'id', | 87 valueField: 'id', |
86 allowBlank: false, | 88 allowBlank: false, |
87 editable: false | 89 editable: false |
88 } | 90 }, |
91 sortable: false, | |
89 }, { | 92 }, { |
90 header: 'Status', | 93 header: 'Status', |
91 dataIndex: 'status', | 94 dataIndex: 'statusWert', |
92 renderer: function(value) { | 95 renderer: function(value) { |
93 if (!value || value === '') { | 96 if (!value || value === '') { |
94 return ''; | 97 return ''; |
95 } | 98 } |
96 return statusStore.getById(value).get('display'); | 99 return statusStore.getById(value).get('wert'); |
97 }, | 100 }, |
98 editor: { | 101 editor: { |
99 xtype: 'combobox', | 102 xtype: 'combobox', |
100 store: statusStore, | 103 store: statusStore, |
101 displayField: 'display', | 104 displayField: 'wert', |
102 valueField: 'id', | 105 valueField: 'id', |
103 allowBlank: false, | 106 allowBlank: false, |
104 editable: false | 107 editable: false |
105 } | 108 }, |
109 sortable: false, | |
106 }, { | 110 }, { |
107 header: 'Text', | 111 header: 'Text', |
108 dataIndex: 'skommentar', | 112 dataIndex: 'text', |
109 flex: 1, | 113 flex: 1, |
110 editor: { | 114 editor: { |
111 allowBlank: true, | 115 allowBlank: true, |
112 maxLength: 1000, | 116 maxLength: 1000, |
113 enforceMaxLength: true | 117 enforceMaxLength: true |
114 } | 118 }, |
119 sortable: false, | |
115 }]; | 120 }]; |
116 this.listeners = { | 121 this.listeners = { |
117 select: { | 122 select: { |
118 fn: this.activateRemoveButton, | 123 fn: this.activateRemoveButton, |
119 scope: this | 124 scope: this |
158 //this.down('button[action=delete]').enable(); | 163 //this.down('button[action=delete]').enable(); |
159 this.down('button[action=add]').enable(); | 164 this.down('button[action=add]').enable(); |
160 } | 165 } |
161 }, | 166 }, |
162 /** | 167 /** |
163 * Activate the Remove Button | 168 * Activate the "Remove Button" |
164 */ | 169 */ |
165 activateRemoveButton: function(selection, record) { | 170 activateRemoveButton: function(selection, record) { |
166 var grid = this; | 171 var grid = this; |
167 //only enable the remove buttone, when the grid is editable. | 172 //only enable the remove buttone, when the grid is editable. |
168 if (! grid.readOnly) { | 173 if (! grid.readOnly) { |
169 grid.down('button[action=delete]').enable(); | 174 grid.down('button[action=delete]').enable(); |
170 } | 175 } |
171 }, | 176 }, |
172 /** | 177 /** |
173 * Activate the Remove Button | 178 * Deactivate the "Remove Button" |
174 */ | 179 */ |
175 deactivateRemoveButton: function(selection, record) { | 180 deactivateRemoveButton: function(selection, record) { |
176 var grid = this; | 181 var grid = this; |
177 //only enable the remove buttone, when the grid is editable. | 182 //only enable the remove buttone, when the grid is editable. |
178 if (! grid.readOnly) { | 183 if (! grid.readOnly) { |