[Lada-commits] [PATCH] More work on the Ortszuordnung grid. Saving does not work yet
Wald Commits
scm-commit at wald.intevation.org
Mon Feb 8 10:34:20 CET 2016
# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1454924005 -3600
# Branch stammdatengrids
# Node ID 6d33a84979e408d8df2c78e774240bf04132936e
# Parent 1df6b6210b428b5fe63b5ed7c1eea3a877dc570a
More work on the Ortszuordnung grid. Saving does not work yet
diff -r 1df6b6210b42 -r 6d33a84979e4 app/controller/form/Ortszuordnung.js
--- 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);
},
/**
diff -r 1df6b6210b42 -r 6d33a84979e4 app/controller/grid/Ortszuordnung.js
--- 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();
diff -r 1df6b6210b42 -r 6d33a84979e4 app/view/form/Ortszuordnung.js
--- 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) {
More information about the Lada-commits
mailing list