can't get dijit textarea to honor spaces/tabs. this custom textarea widget (much...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Apr 2009 19:44:53 +0000 (19:44 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 24 Apr 2009 19:44:53 +0000 (19:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12981 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/Textarea.js [new file with mode: 0644]

diff --git a/Open-ILS/web/js/dojo/openils/widget/Textarea.js b/Open-ILS/web/js/dojo/openils/widget/Textarea.js
new file mode 100644 (file)
index 0000000..2af9f6f
--- /dev/null
@@ -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);
+                }
+            }
+        }
+    );
+}
+