details: https://code.openbravo.com/erp/devel/pi/rev/aeabf2df2bf1
changeset: 24242:aeabf2df2bf1
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Tue Aug 12 10:40:01 2014 +0200
summary: Fixes issue 27297: Bad behavior when a record is created with lazy
filtering
The problem was that the grid data, a ResultSet, was not being created until
the first fetch call was done. If a record is created before the first fetch
call, which is possible only using lazy filtering, then the record will not be
shown in the grid until a fetch call is done, although it will be stored
properly in the database. This also results in a wrong message being shown in
the active subtab after saving the record.
To fix this, and empty ResultSet is created when a new record is created if the
grid does not have a ResultSet yet.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
| 17 +++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (34 lines):
diff -r ee7091c40efb -r aeabf2df2bf1
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
Mon Aug 11 08:51:14 2014 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
Tue Aug 12 10:40:01 2014 +0200
@@ -109,6 +109,12 @@
var view = this.view,
grid = view.viewGrid;
+ if (grid.lazyFiltering && !isc.isA.ResultSet(grid.data)) {
+ grid.dataProperties.dataSource = grid.dataSource;
+ grid.dataProperties.initialData = [];
+ grid.dataProperties.resultSize = 100;
+ grid.setData(grid.createDataModel());
+ }
// In case of no record selected getRecordIndex(undefined) returns -1,
// which is the top position, other case it adds bellow current selected
row.
if (grid.getSelectedRecord()) {
@@ -131,7 +137,16 @@
NEW_DOC_BUTTON_PROPERTIES: {
action: function () {
- this.view.newDocument();
+ var view = this.view,
+ grid = view.viewGrid;
+
+ if (grid.lazyFiltering && !isc.isA.ResultSet(grid.data)) {
+ grid.dataProperties.dataSource = grid.dataSource;
+ grid.dataProperties.initialData = [];
+ grid.dataProperties.resultSize = 100;
+ grid.setData(grid.createDataModel());
+ }
+ view.newDocument();
},
buttonType: 'newDoc',
sortPosition: 10,
------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits