Prevent caching in the selector item in the standard way
authorMartin Taal <martin.taal@openbravo.com>
Tue, 17 May 2011 21:08:54 +0200
changeset 12208 bb06abdd13c1
parent 12207 9c8382863b3b
child 12209 1d0fdd55e10a
Prevent caching in the selector item in the standard way
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue May 17 21:05:00 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue May 17 21:08:54 2011 +0200
@@ -706,11 +706,7 @@
     if (prop === OB.Constants.ID) {
       return;
     }
-    
-    if (field && field.resetCache) {
-      field.resetCache();
-    }
-    
+     
     // note field can be a datasource field, see above, in that case
     // don't set the entries    
     if (field.form && entries) {
@@ -944,15 +940,7 @@
     // remove the message
     this.setHasChanged(true);
     this.view.messageBar.hide();
-    this.view.toolBar.updateButtonState(true);
-    
-    // invalidate the cache of picklists on a change
-    for (i = 0; i < this.getFields().length; i++) {
-      if (this.getFields()[i].resetCache) {
-        this.getFields()[i].resetCache();
-      }
-   }
- 
+    this.view.toolBar.updateButtonState(true); 
   },
   
   // make sure that any field errors also appear in the grid
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue May 17 21:05:00 2011 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue May 17 21:08:54 2011 +0200
@@ -404,16 +404,6 @@
     return this.Super('init', arguments);
   },
   
-  // reset the cache without reloading directly
-  resetCache: function() {
-    if (this.pickList && this.pickList.data) {
-      // don't use field.pickList.invalidateCache as it will force a fetch
-      // the fetch is only needed later when someone really changes the value
-      this.pickList.data.invalidateRows();
-      this.pickList.data.totalRows = 0;
-    }
-  },
-  
   setValueFromRecord: function(record, fromPopup){
     var currentValue = this.getValue();
     if (!record) {
@@ -535,15 +525,10 @@
                      _constructor: 'AdvancedCriteria',
                      criteria:[]};
 
-    // add organization to the criteria as a dummy
     var contextInfo = this.form.view.getContextInfo(false, true);
-    if (contextInfo.inpadOrgId) {
-        criteria.criteria.push({
-          fieldName: '_dummy',
-          operator: 'equals',
-          value: contextInfo.inpadOrgId
-        });
-    }
+
+    // add a dummy criteria to force a fetch
+    criteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
 
     // only filter if the display field is also passed
     // the displayField filter is not passed when the user clicks the drop-down button