Mercurial > lada > lada-client
changeset 270:0d6552bb28ea
Add cancel Button to the editproben window and only show save button if the
form is actually writeable.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 06 Aug 2013 14:33:14 +0200 |
parents | eda619ad45b0 |
children | 11f8a2c1b610 |
files | app/controller/Proben.js app/view/messwerte/Create.js app/view/proben/Create.js app/view/proben/Edit.js app/view/widgets/LadaForm.js |
diffstat | 5 files changed, 39 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/Proben.js Mon Jul 29 15:53:24 2013 +0200 +++ b/app/controller/Proben.js Tue Aug 06 14:33:14 2013 +0200 @@ -23,6 +23,12 @@ 'probenlist toolbar button[action=add]': { click: this.addProbe }, + 'probencreate button[action=save]': { + click: this.saveProbe + }, + 'probenedit button[action=save]': { + click: this.saveProbe + }, 'probencreate form': { savesuccess: this.createSuccess, savefailure: this.createFailure @@ -33,6 +39,11 @@ } }); }, + saveProbe: function(button) { + console.log('Saving Probe'); + var form = button.up('window').down('form'); + form.commit(); + }, addProbe: function(button) { console.log('Adding new Probe'); var view = Ext.widget('probencreate');
--- a/app/view/messwerte/Create.js Mon Jul 29 15:53:24 2013 +0200 +++ b/app/view/messwerte/Create.js Tue Aug 06 14:33:14 2013 +0200 @@ -8,8 +8,6 @@ modal: true, initComponent: function() { - var form = Ext.create('Lada.view.messwerte.CreateForm', this.initialConfig); - this.items = [form]; this.buttons = [ { text: 'Speichern', @@ -17,6 +15,8 @@ action: 'save' } ]; + var form = Ext.create('Lada.view.messwerte.CreateForm', this.initialConfig); + this.items = [form]; this.callParent(); } });
--- a/app/view/proben/Create.js Mon Jul 29 15:53:24 2013 +0200 +++ b/app/view/proben/Create.js Tue Aug 06 14:33:14 2013 +0200 @@ -16,8 +16,12 @@ this.buttons = [ { text: 'Speichern', - handler: form.commit, - scope: form + action: 'save', + }, + { + text: 'Abbrechen', + scope: this, + handler: this.close, } ]; this.callParent();
--- a/app/view/proben/Edit.js Mon Jul 29 15:53:24 2013 +0200 +++ b/app/view/proben/Edit.js Tue Aug 06 14:33:14 2013 +0200 @@ -12,19 +12,23 @@ modal: true, initComponent: function() { + this.buttons = [ + { + text: 'Speichern', + action: 'save', + }, + { + text: 'Abbrechen', + scope: this, + handler: this.close, + } + ]; // InitialConfig is the config object passed to the constructor on // creation of this window. We need to pass it throuh to the form as // we need the "modelId" param to load the correct item. var form = Ext.create('Lada.view.proben.EditForm', this.initialConfig); this.items = [form]; - this.buttons = [ - { - text: 'Speichern', - handler: form.commit, - scope: form - } - ]; this.callParent(); - } + }, });
--- a/app/view/widgets/LadaForm.js Mon Jul 29 15:53:24 2013 +0200 +++ b/app/view/widgets/LadaForm.js Tue Aug 06 14:33:14 2013 +0200 @@ -129,6 +129,14 @@ for (var i = childs.length - 1; i >= 0; i--){ childs[i].setVisible(false); } + /* Find Save-Button and hide it */ + var win = this.up('window'); + var buttons = win.query('.button'); + for (var j = buttons.length - 1; j >= 0; j--){ + if (buttons[j].text === 'Speichern') { + buttons[j].setVisible(false); + }; + }; } }, parseResponse: function(response) {