From 9b7d7b9c4d9ab106c77cfe5073dd4beec41893a2 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 14 Apr 2009 14:14:11 +0000 Subject: [PATCH] allow the grid to render display labels for linked classes that it can retrieve git-svn-id: svn://svn.open-ils.org/ILS/trunk@12863 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/widget/AutoFieldWidget.js | 14 +++++++++----- Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 648ec93b20..412100224c 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -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; diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index e2f1d63404..83600e5983 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -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(); } } -- 2.43.2