comparison app/controller/Proben.js @ 69:cb1138f5cea7

Removed old code
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 05 Jun 2013 15:43:05 +0200
parents 9e2e09e819fd
children 1a943947a7d2
comparison
equal deleted inserted replaced
68:e54cb2f3566e 69:cb1138f5cea7
20 console.log('Initialising the Proben controller'); 20 console.log('Initialising the Proben controller');
21 this.control({ 21 this.control({
22 // CSS like selector to select element in the viewport. See 22 // CSS like selector to select element in the viewport. See
23 // ComponentQuery documentation for more details. 23 // ComponentQuery documentation for more details.
24 'probenlist': { 24 'probenlist': {
25 // Map the "render" event to the given function.
26 render: this.onPanelRendered,
27 // Map Doubleclick on rows of the probenlist.
28 itemdblclick: this.editProbe 25 itemdblclick: this.editProbe
29 }, 26 },
30 'probenlist toolbar button[action=add]': { 27 'probenlist toolbar button[action=add]': {
31 // Map Doubleclick on rows of the probenlist.
32 click: this.addProbe 28 click: this.addProbe
33 }, 29 },
34 'probenedit button[action=save]': {
35 click: this.updateProbe
36 } 30 }
37 }); 31 });
38 },
39 onPanelRendered: function() {
40 console.log('The panel was rendered');
41 }, 32 },
42 addProbe: function(button) { 33 addProbe: function(button) {
43 console.log('Adding new Probe'); 34 console.log('Adding new Probe');
44 var view = Ext.widget('probencreate'); 35 var view = Ext.widget('probencreate');
45 var form = view.down('form');
46 // Create a new Kommentar
47 var record = Ext.create('Lada.model.Probe');
48 form.loadRecord(record);
49 }, 36 },
50 editProbe: function(grid, record) { 37 editProbe: function(grid, record) {
51 console.log('Double click on ' + record.get('probeId')); 38 console.log('Double click on ' + record.get('probeId'));
52 // Create new window to edit the seletced record. 39 // Create new window to edit the seletced record.
53 var view = Ext.widget('probenedit'); 40 var view = Ext.widget('probenedit');
64 }); 51 });
65 52
66 // Set form data 53 // Set form data
67 console.log("Loaded probe with ID " + record.getId()); //outputs ID 54 console.log("Loaded probe with ID " + record.getId()); //outputs ID
68 }, 55 },
69 updateProbe: function(button) { 56 createSuccess: function(form, record, operation) {
70 console.log('Click save'); 57 var win = form.up('window');
71 // We only have a reference to the button here but we really wnat to
72 // get the form and the window. So first get the window and form and
73 // the the record an values.
74 var win = button.up('window');
75 var form = win.down('form');
76 var record = form.getRecord();
77 var values = form.getValues();
78
79 record.set(values);
80 win.close(); 58 win.close();
81 // synchronize the store after editing the record
82 // NOTE: The function 'getProbenStore' will be generated
83 // dynamically based on the Name of the configured Store!!!
84 this.getProbenStore().sync();
85 } 59 }
86 }); 60 });

http://lada.wald.intevation.org