details: https://code.openbravo.com/erp/devel/pi/rev/f8a24f45788a
changeset: 22135:f8a24f45788a
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Mon Feb 24 12:55:18 2014 +0100
summary: fixed bug 25789: duplicated records appearing in the grid after
refreshing
Fixed 2 problems:
-When targetRecordId is sent to the datasource, startRow is recomputed but
it was sent
back with the original value, this caused incorrect rows computation in
client side
-Reasiging totalRows should not decrease it's number because it causes
incorrect pagination
this is related to 2nd request reported in issue #25811
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
| 12 ++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
| 6 +++-
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
| 4 ++-
3 files changed, 17 insertions(+), 5 deletions(-)
diffs (73 lines):
diff -r cd2d90ad02f9 -r f8a24f45788a
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
Mon Feb 24 16:19:03 2014 +0530
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
Mon Feb 24 12:55:18 2014 +0100
@@ -233,7 +233,7 @@
},
transformData: function (newData, dsResponse) {
- var i, length, timeFields, responseToFilter;
+ var i, length, timeFields, responseToFilter, newTotalRows;
// when the data is received from the datasource, time fields are
formatted in UTC time. They have to be converted to local time
if (dsResponse && dsResponse.context &&
(dsResponse.context.operationType === 'fetch' ||
dsResponse.context.operationType === 'update' ||
dsResponse.context.operationType === 'add')) {
@@ -256,14 +256,22 @@
if (this.localData && !responseToFilter) {
length = this.localData.length;
+ newTotalRows = dsResponse.totalRows;
for (i = dsResponse.endRow + 1; i < length; i++) {
if (!Array.isLoading(this.localData[i]) && this.localData[i]) {
- dsResponse.totalRows = i + 1;
+ newTotalRows = i + 1;
} else {
break;
}
}
+ // never decrease totalRows because when multiple requests are
obtained it can
+ // cause an incorrect computation of the whole data size
+ if (newTotalRows > dsResponse.totalRows) {
+ dsResponse.totalRows = newTotalRows + 1;
+ // increase one to request additional page to backend
+ }
+
// get rid of old loading markers, this has to be done explicitly
// as we can return another rowset than requested
// call with a delay otherwise the grid will keep requesting rows
while processing the
diff -r cd2d90ad02f9 -r f8a24f45788a
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
Mon Feb 24 16:19:03 2014 +0530
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
Mon Feb 24 12:55:18 2014 +0100
@@ -2242,8 +2242,10 @@
grid = me.viewGrid,
currentRecord, currentID;
currentRecord = grid.getSelectedRecord();
- context.rowNum = grid.getRecordIndex(currentRecord);
- currentID = currentRecord[OB.Constants.ID];
+ if (currentRecord) {
+ context.rowNum = grid.getRecordIndex(currentRecord);
+ currentID = currentRecord[OB.Constants.ID];
+ }
context.grid = grid;
response.clientContext = context;
if (originalID === currentID) {
diff -r cd2d90ad02f9 -r f8a24f45788a
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
Mon Feb 24 16:19:03 2014 +0530
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
Mon Feb 24 12:55:18 2014 +0100
@@ -116,7 +116,6 @@
// explicitly
boolean doCount = false;
int count = -1;
- int startRow = (startRowStr != null ? queryService.getFirstResult() :
0);
int computedMaxResults = (queryService.getMaxResults() == null ?
Integer.MAX_VALUE
: queryService.getMaxResults());
if (startRowStr != null) {
@@ -181,6 +180,9 @@
}
bobs = bobFetchTransformation(bobs, parameters);
+ // take start row from actual query service because it can be modified
from the originally
+ // requested one
+ int startRow = queryService.getFirstResult();
if (preventCountOperation) {
count = bobs.size() + startRow;
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits