Mercurial > lada > lada-client
view app/controller/MKommentare.js @ 309:51897f9a6bbb
Use ts2date function from lib.Helpers. Remove old code
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 09 Aug 2013 15:24:00 +0200 |
parents | e95662994c50 |
children | 6a7a9267e00f |
line wrap: on
line source
/** * Controller for Kommentare on Messungen */ Ext.define('Lada.controller.MKommentare', { extend: 'Lada.controller.Base', views: [ 'mkommentare.Create' ], stores: [ 'MKommentare' ], models: [ 'MKommentar' ], init: function() { console.log('Initialising the MKommentare controller'); this.callParent(); }, addListeners: function() { this.control({ 'mkommentarelist': { itemdblclick: this.editItem }, 'mkommentarelist toolbar button[action=add]': { click: this.addItem }, 'mkommentarelist toolbar button[action=delete]': { click: this.deleteItem }, 'mkommentarecreate button[action=save]': { click: this.saveItem }, 'mkommentarecreate form': { savesuccess: this.createSuccess, savefailure: this.createFailure } }); }, addItem: function(button) { console.log('Adding new MKommentar for Messung ' + button.parentId + ' Probe ' + button.probeId); var kommentar = Ext.create('Lada.model.MKommentar'); kommentar.set('probeId', button.probeId); kommentar.set('messungsId', button.parentId); var view = Ext.widget('mkommentarecreate', {model: kommentar}); }, editItem: function(grid, record) { console.log('Editing Kommentar'); var view = Ext.widget('mkommentarecreate', {model: record}); console.log("Loaded MKommentar with ID " + record.getId()); //outputs ID }, createSuccess: function(form, record, operation) { // Reload store var store = this.getMKommentareStore(); store.reload(); var win = form.up('window'); win.close(); } });