Author: damoxc

Revision: 5837

Log:
        allow setting of the value without firing an event

Diff:
Modified: branches/1.2_RC/deluge/ui/web/js/ext-extensions-debug.js
===================================================================
--- branches/1.2_RC/deluge/ui/web/js/ext-extensions-debug.js    2009-10-12 
16:44:30 UTC (rev 5836)
+++ branches/1.2_RC/deluge/ui/web/js/ext-extensions-debug.js    2009-10-12 
16:45:28 UTC (rev 5837)
@@ -763,36 +763,39 @@
 // Allow radiogroups to be treated as a single form element.
 Ext.override(Ext.form.RadioGroup, {
 
-       afterRender: function() {
-               var that = this;
-               this.items.each(function(i) {
-                       that.relayEvents(i, ['check']);
-               });
-               Ext.form.RadioGroup.superclass.afterRender.call(this)
-       },
+    afterRender: function() {
+       var that = this;
+       this.items.each(function(i) {
+           that.relayEvents(i, ['check']);
+       });
+       Ext.form.RadioGroup.superclass.afterRender.call(this)
+    },
 
-       getName: function() {
-               return this.items.first().getName();
-       },
+    getName: function() {
+       return this.items.first().getName();
+    },
 
-       getValue: function() {
-               var v;
+    getValue: function() {
+       var v;
+       v = this.items.first().getGroupValue();
+       //this.items.each(function(item) {
+       //    v = item.getRawValue();
+       //    return !item.getValue();
+       //});
+       return v;
+    },
 
-               this.items.each(function(item) {
-                       v = item.getRawValue();
-                       return !item.getValue();
-               });
-
-               return v;
-       },
-
-       setValue: function(v) {
-               if (!this.items.each) return;
-               this.items.each(function(item) {
-                       var checked = (item.el.getValue() == String(v));
-                       item.setValue(checked);
-               });
-       }
+    setValue: function(v) {
+       if (!this.items.each) return;
+       this.items.each(function(item) {
+           var checked = (item.el.getValue() == String(v));
+           if (item.rendered) {
+               item.el.dom.checked = checked;
+               item.el.dom.defaultChecked = checked;
+               item.wrap[checked ? 'addClass' : 
'removeClass'](item.checkedCls);
+           }
+       });
+    }
 });
 
 Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {

Modified: trunk/deluge/ui/web/js/ext-extensions-debug.js
===================================================================
--- trunk/deluge/ui/web/js/ext-extensions-debug.js      2009-10-12 16:44:30 UTC 
(rev 5836)
+++ trunk/deluge/ui/web/js/ext-extensions-debug.js      2009-10-12 16:45:28 UTC 
(rev 5837)
@@ -763,36 +763,39 @@
 // Allow radiogroups to be treated as a single form element.
 Ext.override(Ext.form.RadioGroup, {
 
-       afterRender: function() {
-               var that = this;
-               this.items.each(function(i) {
-                       that.relayEvents(i, ['check']);
-               });
-               Ext.form.RadioGroup.superclass.afterRender.call(this)
-       },
+    afterRender: function() {
+       var that = this;
+       this.items.each(function(i) {
+           that.relayEvents(i, ['check']);
+       });
+       Ext.form.RadioGroup.superclass.afterRender.call(this)
+    },
 
-       getName: function() {
-               return this.items.first().getName();
-       },
+    getName: function() {
+       return this.items.first().getName();
+    },
 
-       getValue: function() {
-               var v;
+    getValue: function() {
+       var v;
+       v = this.items.first().getGroupValue();
+       //this.items.each(function(item) {
+       //    v = item.getRawValue();
+       //    return !item.getValue();
+       //});
+       return v;
+    },
 
-               this.items.each(function(item) {
-                       v = item.getRawValue();
-                       return !item.getValue();
-               });
-
-               return v;
-       },
-
-       setValue: function(v) {
-               if (!this.items.each) return;
-               this.items.each(function(item) {
-                       var checked = (item.el.getValue() == String(v));
-                       item.setValue(checked);
-               });
-       }
+    setValue: function(v) {
+       if (!this.items.each) return;
+       this.items.each(function(item) {
+           var checked = (item.el.getValue() == String(v));
+           if (item.rendered) {
+               item.el.dom.checked = checked;
+               item.el.dom.defaultChecked = checked;
+               item.wrap[checked ? 'addClass' : 
'removeClass'](item.checkedCls);
+           }
+       });
+    }
 });
 
 Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {



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