Mercurial > lada > lada-client
diff app/controller/Messungen.js @ 491:850ccfe5f3c4
Code style.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 31 Oct 2014 23:23:32 +0100 |
parents | 446e99cfd425 |
children | d07e5086a64b |
line wrap: on
line diff
--- a/app/controller/Messungen.js Fri Oct 31 21:28:31 2014 +0100 +++ b/app/controller/Messungen.js Fri Oct 31 23:23:32 2014 +0100 @@ -11,10 +11,12 @@ */ Ext.define('Lada.controller.Messungen', { extend: 'Lada.controller.Base', + views: [ 'messungen.Create', 'messungen.Edit' ], + stores: [ 'Proben', 'Messungen', @@ -23,10 +25,12 @@ 'Status', 'StaMessgroessen' ], + init: function() { console.log('Initialising the Messungen controller'); this.callParent(); }, + addListeners: function() { this.control({ 'messungenlist': { @@ -54,17 +58,20 @@ } }); }, + saveItem: function(button) { console.log('Saving new Messung for Probe ' + button.probeId); var form = button.up('window').down('form'); form.commit(); }, + addItem: function(button) { console.log('Adding new Messung for Probe ' + button.probeId); var messung = Ext.create('Lada.model.Messung'); messung.set('probeId', button.probeId); var view = Ext.widget('messungencreate', {model: messung}); }, + editItem: function(grid, record) { console.log('Editing Messung'); var kstore = this.getKommentareMStore(); @@ -91,8 +98,11 @@ record.getAuthInfo(this.initEditWindow); console.log("Loaded Messung with ID " + record.getId()); //outputs ID }, + initEditWindow: function(record, readonly, owner) { - var view = Ext.widget('messungenedit', {model: record}); + var view = Ext.widget('messungenedit', { + model: record + }); var ignore = Array(); if (owner) { ignore.push('fertig'); @@ -102,12 +112,13 @@ form.setReadOnly(true, ignore); } }, + deleteItem: function(button) { // Get selected item in grid var grid = button.up('grid'); var selection = grid.getView().getSelectionModel().getSelection()[0]; - Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn){ - if(btn === 'yes'){ + Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) { + if (btn === 'yes') { var store = grid.getStore(); var deleteUrl = selection.getProxy().url + selection.getId(); Ext.Ajax.request({ @@ -123,12 +134,14 @@ } }); }, + createSuccess: function(form, record, operation) { var store = this.getMessungenStore(); store.reload(); var win = form.up('window'); win.close(); }, + createFailure: function(form, record, operation) { Ext.MessageBox.show({ title: 'Fehler beim Speichern', @@ -137,12 +150,14 @@ buttons: Ext.Msg.OK }); }, + editSuccess: function(form, record, operation) { var store = this.getMessungenStore(); store.reload(); var win = form.up('window'); win.close(); }, + editFailure: function(form, record, operation) { Ext.MessageBox.show({ title: 'Fehler beim Speichern',