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

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 24 15:44:57 EDT 2009


Author: erickson
Date: 2009-04-24 15:44:53 -0400 (Fri, 24 Apr 2009)
New Revision: 12981

Added:
   trunk/Open-ILS/web/js/dojo/openils/widget/Textarea.js
Log:
can't get dijit textarea to honor spaces/tabs.  this custom textarea widget (much simpler) works nicely

Added: trunk/Open-ILS/web/js/dojo/openils/widget/Textarea.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/Textarea.js	                        (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/Textarea.js	2009-04-24 19:44:53 UTC (rev 12981)
@@ -0,0 +1,41 @@
+if(!dojo._hasResource['openils.widget.Textarea']) {
+    dojo.provide('openils.widget.Textarea');
+    dojo.require("dijit.form._FormWidget");
+
+   /**
+     * Simple textarea that honors spaces/tabs
+     */
+
+    dojo.declare(
+        'openils.widget.Textarea', dijit.form._FormValueWidget,
+        {
+            width : '',
+            height : '',
+            templateString : '<textarea class="openils-widget-textarea" value="${value}" dojoAttachPoint="formValueNode,editNode,focusNode,styleNode"></textarea>',
+            
+            constructor : function(args) {
+                if(!args) args = {};
+                this.width = args.width || openils.widget.Textarea.width;
+                this.height = args.height || openils.widget.Textarea.height;
+            },
+            
+            postCreate : function() {
+                if(this.width)
+                    dojo.style(this.domNode, 'width', this.width);
+                if(this.height)
+                    dojo.style(this.domNode, 'height', this.height);
+            },
+
+            attr : function(name, val) {
+                if(name == 'value') {
+                    if(val)
+                        this.domNode.value = val;
+                    return this.domNode.value;
+                } else {
+                    return this.inherited(arguments);
+                }
+            }
+        }
+    );
+}
+



More information about the open-ils-commits mailing list