Mercurial > lada > lada-client
comparison app/controller/Kommentare.js @ 60:5db7ab34af6d
Implemented Adding und Editing Kommentare
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 29 May 2013 16:06:43 +0200 |
parents | 9e23eca8dfc7 |
children | 20a4f9aaecde |
comparison
equal
deleted
inserted
replaced
59:9e23eca8dfc7 | 60:5db7ab34af6d |
---|---|
17 // ComponentQuery documentation for more details. | 17 // ComponentQuery documentation for more details. |
18 'kommentarelist': { | 18 'kommentarelist': { |
19 // Map Doubleclick on rows of the probenlist. | 19 // Map Doubleclick on rows of the probenlist. |
20 itemdblclick: this.editKommentar | 20 itemdblclick: this.editKommentar |
21 }, | 21 }, |
22 'kommentarelist toolbar button[action=add]': { | |
23 click: this.addKommentar | |
24 }, | |
22 'kommentarelist toolbar button[action=delete]': { | 25 'kommentarelist toolbar button[action=delete]': { |
23 click: this.deleteKommentar | 26 click: this.deleteKommentar |
27 }, | |
28 'kommentaredit button[action=save]': { | |
29 click: this.saveKommentar | |
24 } | 30 } |
25 //'probenedit button[action=save]': { | 31 //'probenedit button[action=save]': { |
26 // click: this.updateProbe | 32 // click: this.updateProbe |
27 //} | 33 //} |
28 }); | 34 }); |
35 }, | |
36 addKommentar: function(button) { | |
37 console.log('Adding new Kommentar'); | |
38 var view = Ext.widget('kommentaredit'); | |
39 var form = view.down('form'); | |
40 // Create a new Kommentar | |
41 var record = Ext.create('Lada.model.Kommentar'); | |
42 form.loadRecord(record); | |
29 }, | 43 }, |
30 deleteKommentar: function(button) { | 44 deleteKommentar: function(button) { |
31 // Get selected item in grid | 45 // Get selected item in grid |
32 var grid = button.up('grid'); | 46 var grid = button.up('grid'); |
33 var selection = grid.getView().getSelectionModel().getSelection()[0]; | 47 var selection = grid.getView().getSelectionModel().getSelection()[0]; |
64 //win.close(); | 78 //win.close(); |
65 //// synchronize the store after editing the record | 79 //// synchronize the store after editing the record |
66 //// NOTE: The function 'getProbenStore' will be generated | 80 //// NOTE: The function 'getProbenStore' will be generated |
67 //// dynamically based on the Name of the configured Store!!! | 81 //// dynamically based on the Name of the configured Store!!! |
68 //this.getProbenStore().sync(); | 82 //this.getProbenStore().sync(); |
83 saveKommentar: function(button) { | |
84 var win = button.up('window'); | |
85 var form = win.down('form'); | |
86 var record = form.getRecord(); | |
87 var values = form.getValues(); | |
88 var store = this.getKommentareStore(); | |
89 record.set(values); | |
90 store.add(record); | |
91 store.sync(); | |
92 console.log('Saving Kommentar'); | |
93 win.close(); | |
69 } | 94 } |
70 }); | 95 }); |