comparison app/view/grid/Probenehmer.js @ 981:2c394e72ba41 stammdatengrids

Use the lada-server for stammdatenqueries.
author Dustin Demuth <dustin@intevation.de>
date Fri, 04 Dec 2015 15:29:04 +0100
parents fb99332bb48e
children d8b0b23047b1
comparison
equal deleted inserted replaced
980:7867752a0d58 981:2c394e72ba41
22 22
23 warnings: null, 23 warnings: null,
24 errors: null, 24 errors: null,
25 readOnly: true, 25 readOnly: true,
26 allowDeselect: true, 26 allowDeselect: true,
27 border: false,
27 28
28 initComponent: function() { 29 initComponent: function() {
29 var i18n = Lada.getApplication().bundle; 30 var i18n = Lada.getApplication().bundle;
30 this.emptyText = i18n.getMsg('pn.emptyGrid'); 31 this.emptyText = i18n.getMsg('pn.emptyGrid');
31 32
36 items: [{ 37 items: [{
37 xtype: 'tbtext', 38 xtype: 'tbtext',
38 id: 'tbtitle', 39 id: 'tbtitle',
39 text: i18n.getMsg('pn.gridTitle') 40 text: i18n.getMsg('pn.gridTitle')
40 }] 41 }]
41 /*
42 //bottom toolbar?
43 }, {
44 xtype: 'toolbar',
45 dock: 'bottom',
46 items: ['->', {
47 text: 'Hinzufügen',
48 icon: 'resources/img/list-add.png',
49 action: 'add',
50 probeId: this.probeId
51 }, {
52 text: 'Löschen',
53 icon: 'resources/img/list-remove.png',
54 action: 'delete'
55 }]
56 */
57 }]; 42 }];
58 /*
59 // Do we have row-editing
60 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
61 clicksToMoveEditor: 1,
62 autoCancel: false,
63 disabled: false,
64 pluginId: 'rowedit',
65 listeners:{
66 // Make row ineditable when readonly is set to true
67 // Normally this would belong into a controller an not the view.
68 // But the RowEditPlugin is not handled there.
69 beforeedit: function(e, o) {
70 var readonlywin = o.grid.up('window').record.get('readonly');
71 var readonlygrid = o.record.get('readonly');
72 if (readonlywin == true || readonlygrid == true || this.disabled) {
73 return false;
74 }
75 return true;
76 }
77 }
78 });
79 this.plugins = [this.rowEditing];
80 */
81 this.columns = [{ 43 this.columns = [{
82 header: i18n.getMsg('netzbetreiberId'), 44 header: i18n.getMsg('netzbetreiberId'),
83 dataIndex: 'netzbetreiberId', 45 dataIndex: 'netzbetreiberId',
84 renderer: function(value) { 46 renderer: function(value) {
85 var r = ''; 47 var r = '';
172 deselect: { 134 deselect: {
173 fn: this.deactivateRemoveButton, 135 fn: this.deactivateRemoveButton,
174 scope: this 136 scope: this
175 } 137 }
176 }; 138 };
177 // this.initData(); //This will be called by the Query Component.
178 this.callParent(arguments); 139 this.callParent(arguments);
179 //TODO this.setReadOnly(true); //Grid is always initialised as RO
180 }, 140 },
181 141
182 initData: function() { 142 /**
183 this.store = Ext.create('Lada.store.DatensatzErzeuger'); 143 * This sets the Store of this Grid
184 this.store.load(); //TODO: Params? 144 */
185 }, 145 setStore: function(store){
146 var i18n = Lada.getApplication().bundle;
186 147
187 setReadOnly: function(b) { 148 this.removeDocked(Ext.getCmp('ptbar'), true);
188 if (b == true){ 149 this.reconfigure(store);
189 //Readonly 150 this.addDocked([{
190 if (this.getPlugin('rowedit')){ 151 xtype: 'pagingtoolbar',
191 this.getPlugin('rowedit').disable(); 152 id: 'ptbar',
192 } 153 dock: 'bottom',
193 try { 154 store: store,
194 this.down('button[action=delete]').disable(); 155 displayInfo: true
195 this.down('button[action=add]').disable(); 156 }]);
196 }
197 catch(e) {
198 //TODO: Do Nothing...
199 }
200 }else{
201 //Writable
202 if (this.getPlugin('rowedit')){
203 this.getPlugin('rowedit').enable();
204 }
205 try {
206 this.down('button[action=delete]').enable();
207 this.down('button[action=add]').enable();
208 }
209 catch(e) {
210 //TODO: Do Nothing...
211 }
212 }
213 },
214 /**
215 * Activate the Remove Button
216 */
217 activateRemoveButton: function(selection, record) {
218 var grid = this;
219 //only enable the remove buttone, when the grid is editable.
220 if (! grid.readOnly) {
221 try {
222 grid.down('button[action=delete]').enable();
223 }
224 catch(e) {
225 //TODO: Do Nothing
226 }
227 }
228 },
229 /**
230 * deactivate the Remove Button
231 */
232 deactivateRemoveButton: function(selection, record) {
233 var grid = this;
234 //only enable the remove buttone, when the grid is editable.
235 if (! grid.readOnly) {
236 try {
237 grid.down('button[action=delete]').disable();
238 }
239 catch(e) {
240 //TODO: Do Nothing
241 }
242 }
243 } 157 }
244 }); 158 });
245 159

http://lada.wald.intevation.org