Module: deluge
Branch: master
Commit: 31304d3397ada86ccaaaa3257c73fe08052d4fd6

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

lazily set the value if the items aren't rendered yet and re-enable setting the 
allocation in the add window

---

 deluge/ui/web/js/deluge-all/add/OptionsTab.js      |    1 -
 .../ui/web/js/ext-extensions/form/RadioGroupFix.js |   17 ++++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/add/OptionsTab.js 
b/deluge/ui/web/js/deluge-all/add/OptionsTab.js
index 45363d6..c1ff5bc 100644
--- a/deluge/ui/web/js/deluge-all/add/OptionsTab.js
+++ b/deluge/ui/web/js/deluge-all/add/OptionsTab.js
@@ -85,7 +85,6 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
                        xtype: 'radiogroup',
                        columns: 1,
                        vertical: true,
-                       disabled: true,
                        labelSeparator: '',
                        items: [{
                                name: 'compact_allocation',
diff --git a/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js 
b/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js
index d5a9ce8..058cc01 100644
--- a/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js
+++ b/deluge/ui/web/js/ext-extensions/form/RadioGroupFix.js
@@ -37,6 +37,11 @@ Ext.override(Ext.form.RadioGroup, {
                this.items.each(function(i) {
                this.relayEvents(i, ['check']);
                }, this);
+               if (this.lazyValue) {
+                       this.setValue(this.value);
+                       delete this.value;
+                       delete this.lazyValue;
+               }
                Ext.form.RadioGroup.superclass.afterRender.call(this)
     },
 
@@ -45,17 +50,15 @@ Ext.override(Ext.form.RadioGroup, {
     },
 
     getValue: function() {
-               //var v;
                return this.items.first().getGroupValue();
-               //this.items.each(function(item) {
-               //    v = item.getRawValue();
-               //    return !item.getValue();
-               //});
-               //return v;
     },
 
     setValue: function(v) {
-               if (!this.items.each) return;
+               if (!this.items.each) {
+                       this.value = v;
+                       this.lazyValue = true;
+                       return;
+               }
                this.items.each(function(item) {
                        if (item.rendered) {
                                var checked = (item.el.getValue() == String(v));

-- 
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