From 7fe5d37094adb3e03dd085f2c32307824f9c4c36 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Tue, 27 Apr 2010 23:18:03 +0100 Subject: [PATCH] fix the spinnergroup widths --- .../js/deluge-all/preferences/NetworkPage.js | 2 -- .../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 bfc0cff00..6d7d83929 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 0a8fdfae3..7703862d9 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);