Mercurial > lada > lada-client
changeset 1022:6d33a84979e4 stammdatengrids
More work on the Ortszuordnung grid. Saving does not work yet
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Mon, 08 Feb 2016 10:33:25 +0100 |
parents | 1df6b6210b42 |
children | 2e7adc19b4fe |
files | app/controller/form/Ortszuordnung.js app/controller/grid/Ortszuordnung.js app/view/form/Ortszuordnung.js |
diffstat | 3 files changed, 31 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/form/Ortszuordnung.js Thu Feb 04 16:31:46 2016 +0100 +++ b/app/controller/form/Ortszuordnung.js Mon Feb 08 10:33:25 2016 +0100 @@ -39,18 +39,18 @@ */ save: function(button) { + var formPanel = button.up('ortszuordnungform'); + //try to disable ortPickerButton: try { - var ob = this.up('form').down('ortszuordnungform button[action=setOrt]'); - if (ob.pressed) { - ob.toggle(false); - } + formPanel.down('button[action=setOrt]').toggle(false); } catch (e) { } - var formPanel = button.up('ortszuordnungform'); var data = formPanel.getForm().getFieldValues(true); + debugger; + console.log(data); var i18n = Lada.getApplication().bundle; for (var key in data) { formPanel.getForm().getRecord().set(key, data[key]); @@ -70,6 +70,14 @@ formPanel.setMessages(json.errors, json.warnings); formPanel.up('window').grid.store.reload(); } + //try to refresh the Grid of the Probe + try { + formPanel.up('window').parentWindow + .down('ortszuordnunggrid').store.reload(); + } + catch (e) { + + } }, failure: function(record, response) { button.setDisabled(true); @@ -104,7 +112,16 @@ */ discard: function(button) { var formPanel = button.up('form'); - formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); + var record = formPanel.getForm().getRecord(); + formPanel.getForm().loadRecord(record); + try { + formPanel.refreshOrt(record.get('ortId')); + formPanel.down('button[action=setOrt]').toggle(false); + } + catch (e) { + } + //set undirty. + formPanel.fireEvent('dirtychange', formPanel.getForm(), false); }, /**
--- a/app/controller/grid/Ortszuordnung.js Thu Feb 04 16:31:46 2016 +0100 +++ b/app/controller/grid/Ortszuordnung.js Mon Feb 08 10:33:25 2016 +0100 @@ -43,7 +43,7 @@ var win = Ext.create('Lada.view.window.Ortszuordnung', { parentWindow: grid.up('window'), probe: grid.up('window').down('probeform').record, - record: record, + record: record.copy(), grid: grid }); win.show();
--- a/app/view/form/Ortszuordnung.js Thu Feb 04 16:31:46 2016 +0100 +++ b/app/view/form/Ortszuordnung.js Mon Feb 08 10:33:25 2016 +0100 @@ -26,7 +26,7 @@ record: null, - //trackResetOnLoad: true, + trackResetOnLoad: true, initComponent: function() { var i18n = Lada.getApplication().bundle; @@ -83,6 +83,7 @@ fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'), }, { xtype: 'textfield', + submitValue: true, readOnly: true, hidden: true, name: 'ortId' @@ -119,12 +120,11 @@ else { this.setReadOnly(true); } - this.refreshOrt(); + var ortId = this.getRecord().get('ortId'); + this.refreshOrt(ortId); }, - refreshOrt: function() { - var ortId = this.getRecord().get('ortId'); - + refreshOrt: function(ortId) { var orteStore = Ext.StoreManager.get('orte'); var ort = orteStore.getById(ortId); var verwStore = Ext.StoreManager.get('verwaltungseinheiten'); @@ -145,18 +145,16 @@ */ setOrt: function(row, selRecord, index, opts) { - console.log('setOrt' + Date.now()); var newOrtId = selRecord.get('id'); var r = this.getRecord(); if (newOrtId) { if (newOrtId != r.get('ortId')) { this.getForm().setValues({ ortId: newOrtId}); - this.refreshOrt(); + this.refreshOrt(newOrtId); //set dirty... - //this.fireEvent('dirtychange', this.getForm(), true); + this.fireEvent('dirtychange', this.getForm(), true); } } - console.log('setOrtEnd' + Date.now()); }, setMessages: function(errors, warnings) {