details: https://code.openbravo.com/erp/devel/pi/rev/b71a7f9c8a25
changeset: 17753:b71a7f9c8a25
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Thu Aug 23 14:24:46 2012 +0200
summary: Fixes issue 21352: Changing the shown fields while editing the grid
is possible
Due to a change in smartclient, it was not possible to hide or show a field in
the grid while editing a row. This happened because when a field was shown or
hided, the edit values of the record were being deleted. This edit values were
being used to retrieve all the record values in order to send them the the FIC.
This deleted values were not being restored ever.
Now, to fix this, the edit values of the grid are saved when hiding or showing
fields. If there is call to doChangeFICCall caused by this, the saved edit
values will be used:
record = isc.addProperties({}, this.viewGrid.getRecord(rowNum),
this.viewGrid.getEditValues(rowNum), this.viewGrid._savedEditValues);
This was only reproducible while editing new rows because saved rows had all
the properties in the own record (this.viewGrid.getRecord()), so it did not
matter that they were being deleted from the edit values.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
| 21 +++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
| 9 +++-
2 files changed, 27 insertions(+), 3 deletions(-)
diffs (63 lines):
diff -r f1c506df75cd -r b71a7f9c8a25
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Thu Aug 23 10:46:07 2012 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Thu Aug 23 14:24:46 2012 +0200
@@ -482,14 +482,24 @@
},
hideField: function (field, suppressRelayout) {
- var res = this.Super('hideField', arguments);
+ var res;
+ this._hidingField = true;
+ this._savedEditValues = this.getEditValues(this.getEditRow());
+ res = this.Super('hideField', arguments);
+ delete this._savedEditValues;
+ delete this._hidingField;
this.view.standardWindow.storeViewState();
this.refreshContents();
return res;
},
showField: function (field, suppressRelayout) {
- var res = this.Super('showField', arguments);
+ var res;
+ this._showingField = true;
+ this._savedEditValues = this.getEditValues(this.getEditRow());
+ res = this.Super('showField', arguments);
+ delete this._savedEditValues;
+ delete this._showingField;
this.view.standardWindow.storeViewState();
this.refreshContents();
return res;
@@ -2297,6 +2307,13 @@
var rowNum = this.getEditRow(),
record = this.getRecord(rowNum),
editForm = this.getEditForm();
+
+ // Do not hide the inline editor if the action has been caused
+ // by hiding or showing a field
+ // See issue https://issues.openbravo.com/view.php?id=21352
+ if (this._hidingField || this._showingField) {
+ return;
+ }
this._hidingInlineEditor = true;
if (record && (rowNum === 0 || rowNum)) {
if (!this.rowHasErrors(rowNum)) {
diff -r f1c506df75cd -r b71a7f9c8a25
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
Thu Aug 23 10:46:07 2012 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
Thu Aug 23 14:24:46 2012 +0200
@@ -1813,7 +1813,14 @@
if (this.isEditingGrid && this.viewGrid.getEditForm()) {
rowNum = this.viewGrid.getEditRow();
if (rowNum || rowNum === 0) {
- record = isc.addProperties({}, this.viewGrid.getRecord(rowNum),
this.viewGrid.getEditValues(rowNum));
+ if (this.viewGrid._hidingField || this.viewGrid._showingField) {
+ // If this has been caused by hiding or showing a field while the
grid was being edited,
+ // add the properties of the saved edit values
+ // See issue https://issues.openbravo.com/view.php?id=21352
+ record = isc.addProperties({}, this.viewGrid.getRecord(rowNum),
this.viewGrid.getEditValues(rowNum), this.viewGrid._savedEditValues);
+ } else {
+ record = isc.addProperties({}, this.viewGrid.getRecord(rowNum),
this.viewGrid.getEditValues(rowNum));
+ }
} else {
record = isc.addProperties({}, this.viewGrid.getSelectedRecord());
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits