comparison app/controller/Kommentare.js @ 288:ea60be45fd4d

Remeoved methods which are defined in the base class.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 09 Aug 2013 14:58:58 +0200
parents c509e9f6d4db
children 6a7a9267e00f
comparison
equal deleted inserted replaced
287:12e7f0ef90b6 288:ea60be45fd4d
10 'Kommentare' 10 'Kommentare'
11 ], 11 ],
12 models: [ 12 models: [
13 'Kommentar' 13 'Kommentar'
14 ], 14 ],
15 init: function() {
16 console.log('Initialising the Kommentare controller');
17 this.callParent();
18 },
15 addListeners: function() { 19 addListeners: function() {
16 this.control({ 20 this.control({
17 'kommentarelist': { 21 'kommentarelist': {
18 itemdblclick: this.editItem 22 itemdblclick: this.editItem
19 }, 23 },
30 savesuccess: this.createSuccess, 34 savesuccess: this.createSuccess,
31 savefailure: this.createFailure 35 savefailure: this.createFailure
32 } 36 }
33 }); 37 });
34 }, 38 },
35 saveItem: function(button) {
36 console.log('Saving Kommentar');
37 var form = button.up('window').down('form');
38 form.commit();
39 },
40 addItem: function(button) { 39 addItem: function(button) {
41 console.log('Adding new Kommentar for Probe ' + button.probeId); 40 console.log('Adding new Kommentar for Probe ' + button.probeId);
42 var kommentar = Ext.create('Lada.model.Kommentar'); 41 var kommentar = Ext.create('Lada.model.Kommentar');
43 kommentar.set('probeId', button.probeId); 42 kommentar.set('probeId', button.probeId);
44 var view = Ext.widget('kommentarecreate', {model: kommentar}); 43 var view = Ext.widget('kommentarecreate', {model: kommentar});
46 editItem: function(grid, record) { 45 editItem: function(grid, record) {
47 console.log('Editing Kommentar'); 46 console.log('Editing Kommentar');
48 var view = Ext.widget('kommentarecreate', {model: record}); 47 var view = Ext.widget('kommentarecreate', {model: record});
49 console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID 48 console.log("Loaded Kommentar with ID " + record.getId()); //outputs ID
50 }, 49 },
51 deleteItem: function(button) {
52 var grid = button.up('grid');
53 var selection = grid.getView().getSelectionModel().getSelection()[0];
54 Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){
55 if(btn === 'yes'){
56 var store = grid.getStore();
57 var deleteUrl = selection.getProxy().url + selection.getEidi();
58 Ext.Ajax.request({
59 url: deleteUrl,
60 method: 'DELETE',
61 success: function(response, opts) {
62 store.reload();
63 }
64 });
65 console.log('Deleting Kommentar');
66 } else {
67 console.log('Cancel Deleting Kommentar');
68 }
69 });
70 },
71 createSuccess: function(form, record, operation) { 50 createSuccess: function(form, record, operation) {
72 var store = this.getKommentareStore(); 51 var store = this.getKommentareStore();
73 store.reload(); 52 store.reload();
74 var win = form.up('window'); 53 var win = form.up('window');
75 win.close(); 54 win.close();
76 },
77 createFailure: function(form, record, operation) {
78 Ext.MessageBox.show({
79 title: 'Fehler beim Speichern',
80 msg: form.message,
81 icon: Ext.MessageBox.ERROR,
82 buttons: Ext.Msg.OK
83 });
84 } 55 }
85 }); 56 });

http://lada.wald.intevation.org