allow the grid to render display labels for linked classes that it can retrieve
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Apr 2009 14:14:11 +0000 (14:14 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Apr 2009 14:14:11 +0000 (14:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12863 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Open-ILS/web/js/dojo/openils/widget/AutoGrid.js

index 648ec93..4121002 100644 (file)
@@ -102,6 +102,9 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                     this.parentNode.appendChild(this.widget.domNode);
                 return;
             }
+            
+            if(!this.parentNode) // give it somewhere to live so that dojo won't complain
+                this.parentNode = document.createElement('div');
 
             this.onload = onload;
             if(this.widgetValue == null)
@@ -175,13 +178,14 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
         // we want to display the value for our widget.  However, instead of displaying
         // an ID, for exmaple, display the value for the 'selector' field on the object
         // the ID points to
-        _tryLinkedDisplayField : function() {
+        _tryLinkedDisplayField : function(noAsync) {
 
             if(this.idlField.datatype == 'org_unit')
                 return false; // we already handle org_units, no need to re-fetch
 
             var linkInfo = this._getLinkSelector();
-            if(!linkInfo || !linkInfo.vfield) return false;
+            if(!(linkInfo && linkInfo.vfield && linkInfo.vfield.selector)) 
+                return false;
             var lclass = linkInfo.linkClass;
 
             // first try the object list cache
@@ -208,7 +212,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             this.async = true;
             var self = this;
             new openils.PermaCrud().retrieve(lclass, this.widgetValue, {   
-                async : true,
+                async : !this.forceSync,
                 oncomplete : function(r) {
                     var item = openils.Util.readResponse(r);
                     if(!self.cacheSingle[lclass])
@@ -281,7 +285,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
 
             } else {
                 new openils.PermaCrud().retrieveAll(linkClass, {   
-                    async : true,
+                    async : !this.forceSync,
                     oncomplete : function(r) {
                         var list = openils.Util.readResponse(r, false, true);
                         oncomplete(list);
@@ -352,7 +356,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             var self = this;
             this.async = true;
             new openils.PermaCrud().retrieveAll('pgt', {
-                async : true,
+                async : !this.forceSync,
                 oncomplete : function(r) {
                     var list = openils.Util.readResponse(r, false, true);
                     if(!list) return;
index e2f1d63..83600e5 100644 (file)
@@ -418,7 +418,10 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             fmClass: this.grid.fmClass,
             fmField: this.field,
             widgetValue : val,
+            readOnly : true,
+            forceSync : true
         });
+        autoWidget.build();
         return autoWidget.getDisplayString();
     }
 }