Module: deluge
Branch: master
Commit: 7fe5d37094adb3e03dd085f2c32307824f9c4c36

Author: Damien Churchill <[email protected]>
Date:   Tue Apr 27 23:18:03 2010 +0100

fix the spinnergroup widths

---

 .../web/js/deluge-all/preferences/NetworkPage.js   |    2 -
 .../ui/web/js/ext-extensions/form/SpinnerGroup.js  |   36 ++++++++++++++++----
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js 
b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js
index bfc0cff..6d7d839 100644
--- a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js
+++ b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js
@@ -80,7 +80,6 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
                        },
                        items: [{
                                fieldLabel: 'From',
-                               width: 50,
                                strategy: {
                                        xtype: 'number',
                                        decimalPrecision: 0,
@@ -89,7 +88,6 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
                                }
                        }, {
                                fieldLabel: 'To',
-                               width: 50,
                                strategy: {
                                        xtype: 'number',
                                        decimalPrecision: 0,
diff --git a/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js 
b/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js
index 0a8fdfa..7703862 100644
--- a/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js
+++ b/deluge/ui/web/js/ext-extensions/form/SpinnerGroup.js
@@ -60,7 +60,7 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, 
{
                 labelWidth: 60,
                 defaults: {
                     hideLabel: true,
-                    anchor: '100%'
+                    anchor: '60%'
                 }
             }, this.colCfg);
 
@@ -155,6 +155,18 @@ Ext.ux.form.SpinnerGroup = 
Ext.extend(Ext.form.CheckboxGroup, {
             this.items.each(function(field) {
                 field.on('change', this.onFieldChange, this);
             }, this);
+
+                       if (this.lazyValueSet) {
+                               this.setValue(this.value);
+                               delete this.value;
+                               delete this.lazyValueSet;
+                       }
+
+                       if (this.lazyRawValueSet) {
+                               this.setRawValue(this.rawValue);
+                               delete this.rawValue;
+                               delete this.lazyRawValueSet;
+                       }
         }
 
         Ext.ux.form.SpinnerGroup.superclass.onRender.call(this, ct, position);
@@ -183,15 +195,25 @@ Ext.ux.form.SpinnerGroup = 
Ext.extend(Ext.form.CheckboxGroup, {
     },
 
     setValue: function(value) {
-        this.items.each(function(item, i) {
-            item.setValue(value[i]);
-        });
+               if (!this.rendered) {
+                       this.value = value;
+                       this.lazyValueSet = true;
+               } else {
+                       this.items.each(function(item, i) {
+                               item.setValue(value[i]);
+                       });
+               }
     },
 
     setRawValue: function(value) {
-        this.items.each(function(item, i) {
-            item.setRawValue(value[i]);
-        });
+               if (!this.rendered) {
+                       this.rawValue = value;
+                       this.lazyRawValueSet = true;
+               } else {
+                       this.items.each(function(item, i) {
+                               item.setRawValue(value[i]);
+                       });
+               }
     }
 });
 Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup);

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to