changeset 228:08144d625b2b

Only iterate over fields of the form is readonly. This increases the performance.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 17 Jul 2013 11:06:47 +0200
parents d3f4a39bf89e
children 80df1451b4a9
files app/view/widgets/LadaForm.js
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/widgets/LadaForm.js	Wed Jul 17 10:58:03 2013 +0200
+++ b/app/view/widgets/LadaForm.js	Wed Jul 17 11:06:47 2013 +0200
@@ -119,14 +119,16 @@
     },
     setReadOnly: function (bReadOnly) {
         /* Iterate over all fields and set them readonly */
-        this.getForm().getFields().each (function (field) {
-            //field.setDisabled(bReadOnly);
-            field.setReadOnly(bReadOnly);
-        });
-        /* Iterate over all toolbars of lists and hide them */
-        var childs = this.query('toolbar');
-        for (var i = childs.length - 1; i >= 0; i--){
-            childs[i].setVisible(false);
+        if (bReadOnly) {
+            this.getForm().getFields().each (function (field) {
+                //field.setDisabled(bReadOnly);
+                field.setReadOnly(true);
+            });
+            /* Iterate over all toolbars of lists and hide them */
+            var childs = this.query('toolbar');
+            for (var i = childs.length - 1; i >= 0; i--){
+                childs[i].setVisible(false);
+            }
         }
     },
     parseResponse: function(response) {

http://lada.wald.intevation.org