fix the spinnergroup widths

This commit is contained in:
Damien Churchill 2010-04-27 23:18:03 +01:00
parent a7940d5bf9
commit 7fe5d37094
2 changed files with 29 additions and 9 deletions

View File

@ -80,7 +80,6 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
}, },
items: [{ items: [{
fieldLabel: 'From', fieldLabel: 'From',
width: 50,
strategy: { strategy: {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
@ -89,7 +88,6 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
} }
}, { }, {
fieldLabel: 'To', fieldLabel: 'To',
width: 50,
strategy: { strategy: {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,

View File

@ -60,7 +60,7 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
labelWidth: 60, labelWidth: 60,
defaults: { defaults: {
hideLabel: true, hideLabel: true,
anchor: '100%' anchor: '60%'
} }
}, this.colCfg); }, this.colCfg);
@ -155,6 +155,18 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
this.items.each(function(field) { this.items.each(function(field) {
field.on('change', this.onFieldChange, this); field.on('change', this.onFieldChange, this);
}, 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); 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) { setValue: function(value) {
this.items.each(function(item, i) { if (!this.rendered) {
item.setValue(value[i]); this.value = value;
}); this.lazyValueSet = true;
} else {
this.items.each(function(item, i) {
item.setValue(value[i]);
});
}
}, },
setRawValue: function(value) { setRawValue: function(value) {
this.items.each(function(item, i) { if (!this.rendered) {
item.setRawValue(value[i]); this.rawValue = value;
}); this.lazyRawValueSet = true;
} else {
this.items.each(function(item, i) {
item.setRawValue(value[i]);
});
}
} }
}); });
Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup); Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup);