From 52daf7cba4a04cacf4e618ee371e2b280984a869 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 12 Apr 2010 12:52:34 +0000 Subject: [PATCH] backport 13966: protecting against dissapearing grid cells during grid render of autowidget git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_0@16198 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js index 6f671dbdec..3d8ee68f9d 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js @@ -117,7 +117,7 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { } if(!this.parentNode) // give it somewhere to live so that dojo won't complain - this.parentNode = document.createElement('div'); + this.parentNode = dojo.create('div'); this.onload = onload; if(this.widgetValue == null) @@ -331,9 +331,21 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) { * For widgets that run asynchronously, provide a callback for finishing up */ _widgetLoaded : function(value) { + if(this.readOnly) { - this.baseWidgetValue(this.getDisplayString()); + + /* ------------------------------------------------------------- + when using widgets in a grid, the cell may dissapear, which + kills the underlying DOM node, which causes this to fail. + For now, back out gracefully and let grid getters use + getDisplayString() instead + -------------------------------------------------------------*/ + try { + this.baseWidgetValue(this.getDisplayString()); + } catch (E) {}; + } else { + this.baseWidgetValue(this.widgetValue); if(this.idlField.name == this.fmIDL.pkey && this.fmIDL.pkey_sequence) this.widget.attr('disabled', true); -- 2.11.0