details:   https://code.openbravo.com/erp/devel/pi/rev/3e63bdd825a2
changeset: 23381:3e63bdd825a2
user:      Guillermo Gil <guillermo.gil <at> openbravo.com>
date:      Mon May 26 15:35:36 2014 +0200
summary:   Fixed issue 26547: Deleted request to know targetRow

TargetRow is now brought from the client instead of calculating it on the server

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
 |  8 ++++++--
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
         |  6 +++++-
 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonConstants.java
                  |  1 +
 3 files changed, 12 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r fee9a7256fe8 -r 3e63bdd825a2 
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 May 26 13:27:53 2014 +0530
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Mon May 26 15:35:36 2014 +0200
@@ -1626,7 +1626,7 @@
 
   refreshGrid: function (callback, newRecordsToBeIncluded) {
     var originalCriteria, criteria = {},
-        newRecordsCriteria, newRecordsLength, i, index;
+        newRecordsCriteria, newRecordsLength, i, index, recordSelected;
 
     //check whether newRecordsToBeIncluded contains records not part of the 
current grid and remove them.
     if (newRecordsToBeIncluded && newRecordsToBeIncluded.length > 0 && 
this.data) {
@@ -1646,10 +1646,14 @@
       this.notRemoveFilter = true;
     }
     this.actionAfterDataArrived = callback;
+    recordSelected = this.getRecordIndex(this.getSelectedRecord());
     this.invalidateCache();
 
     var context = {
-      showPrompt: false
+      showPrompt: false,
+      params: {
+        _recordSelected: recordSelected
+      }
     };
 
     // Removes the 'or' clause, if there is one
diff -r fee9a7256fe8 -r 3e63bdd825a2 
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 May 26 13:27:53 2014 +0530
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
     Mon May 26 15:35:36 2014 +0200
@@ -432,7 +432,11 @@
     if (!forCountOperation && !directNavigation
         && parameters.containsKey(JsonConstants.TARGETRECORDID_PARAMETER)) {
       final String targetRecordId = 
parameters.get(JsonConstants.TARGETRECORDID_PARAMETER);
-      targetRowNumber = queryService.getRowNumber(targetRecordId);
+      if (parameters.containsKey((JsonConstants.RECORD_SELECTED))) {
+        targetRowNumber = 
Integer.parseInt(parameters.get(JsonConstants.RECORD_SELECTED));
+      } else {
+        targetRowNumber = queryService.getRowNumber(targetRecordId);
+      }
       if (targetRowNumber != -1) {
         startRow = targetRowNumber;
         // if the startrow is really low, then just read from 0
diff -r fee9a7256fe8 -r 3e63bdd825a2 
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonConstants.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonConstants.java
      Mon May 26 13:27:53 2014 +0530
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonConstants.java
      Mon May 26 15:35:36 2014 +0200
@@ -62,6 +62,7 @@
   public static final String ENDROW_PARAMETER = "_endRow";
   public static final String SORTBY_PARAMETER = "_sortBy";
   public static final String TARGETRECORDID_PARAMETER = "_targetRecordId";
+  public static final String RECORD_SELECTED = "_recordSelected";
   public static final String DATASOURCE_PARAMETER = "_dataSource";
   public static final String TEXTMATCH_PARAMETER = "_textMatchStyle";
   public static final String TEXTMATCH_PARAMETER_OVERRIDE = 
"_textMatchStyleOverride";

------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to