Mercurial > lada > lada-client
diff 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 |
line wrap: on
line diff
--- a/app/controller/Kommentare.js Wed May 29 15:27:07 2013 +0200 +++ b/app/controller/Kommentare.js Wed May 29 16:06:43 2013 +0200 @@ -19,14 +19,28 @@ // Map Doubleclick on rows of the probenlist. itemdblclick: this.editKommentar }, + 'kommentarelist toolbar button[action=add]': { + click: this.addKommentar + }, 'kommentarelist toolbar button[action=delete]': { click: this.deleteKommentar + }, + 'kommentaredit button[action=save]': { + click: this.saveKommentar } //'probenedit button[action=save]': { // click: this.updateProbe //} }); }, + addKommentar: function(button) { + console.log('Adding new Kommentar'); + var view = Ext.widget('kommentaredit'); + var form = view.down('form'); + // Create a new Kommentar + var record = Ext.create('Lada.model.Kommentar'); + form.loadRecord(record); + }, deleteKommentar: function(button) { // Get selected item in grid var grid = button.up('grid'); @@ -66,5 +80,16 @@ //// NOTE: The function 'getProbenStore' will be generated //// dynamically based on the Name of the configured Store!!! //this.getProbenStore().sync(); + saveKommentar: function(button) { + var win = button.up('window'); + var form = win.down('form'); + var record = form.getRecord(); + var values = form.getValues(); + var store = this.getKommentareStore(); + record.set(values); + store.add(record); + store.sync(); + console.log('Saving Kommentar'); + win.close(); } });