[open-ils-commits] r12863 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 14 10:14:13 EDT 2009


Author: erickson
Date: 2009-04-14 10:14:11 -0400 (Tue, 14 Apr 2009)
New Revision: 12863

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
   trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Log:
allow the grid to render display labels for linked classes that it can retrieve

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js	2009-04-14 03:20:19 UTC (rev 12862)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js	2009-04-14 14:14:11 UTC (rev 12863)
@@ -102,6 +102,9 @@
                     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 @@
         // 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 @@
             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 @@
 
             } 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 @@
             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;

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-04-14 03:20:19 UTC (rev 12862)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-04-14 14:14:11 UTC (rev 12863)
@@ -418,7 +418,10 @@
             fmClass: this.grid.fmClass,
             fmField: this.field,
             widgetValue : val,
+            readOnly : true,
+            forceSync : true
         });
+        autoWidget.build();
         return autoWidget.getDisplayString();
     }
 }



More information about the open-ils-commits mailing list