fix a bug in the spinner to force the decimal precision to be displayed

This commit is contained in:
Damien Churchill 2009-06-05 07:39:45 +00:00
parent db36e9dbfa
commit edd3b5d847
4 changed files with 27 additions and 20 deletions

View File

@ -89,10 +89,12 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
id: 'max_download_speed', id: 'max_download_speed',
name: 'max_download_speed', name: 'max_download_speed',
width: 70, width: 70,
stragegy: new Ext.ux.form.Spinner.NumberStrategy({ strategy: {
xtype: 'number',
decimalPrecision: 1,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999
}), },
listeners: { listeners: {
'spin': { 'spin': {
fn: this.onFieldChange, fn: this.onFieldChange,
@ -124,11 +126,12 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
name: 'max_upload_speed', name: 'max_upload_speed',
width: 70, width: 70,
value: -1, value: -1,
stragegy: new Ext.ux.form.Spinner.NumberStrategy({ strategy: {
xtype: 'number',
decimalPrecision: 1,
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999
incrementValue: 1 },
}),
listeners: { listeners: {
'spin': { 'spin': {
fn: this.onFieldChange, fn: this.onFieldChange,
@ -160,11 +163,12 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
name: 'max_connections', name: 'max_connections',
width: 70, width: 70,
value: -1, value: -1,
stragegy: new Ext.ux.form.Spinner.NumberStrategy({ strategy: {
xtype: 'number',
decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999
incrementValue: 1 },
}),
listeners: { listeners: {
'spin': { 'spin': {
fn: this.onFieldChange, fn: this.onFieldChange,
@ -192,11 +196,12 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
name: 'max_upload_slots', name: 'max_upload_slots',
width: 70, width: 70,
value: -1, value: -1,
stragegy: new Ext.ux.form.Spinner.NumberStrategy({ strategy: {
xtype: 'number',
decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999
incrementValue: 1 },
}),
listeners: { listeners: {
'spin': { 'spin': {
fn: this.onFieldChange, fn: this.onFieldChange,
@ -264,12 +269,14 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
disabled: true, disabled: true,
width: 50, width: 50,
value: 2.0, value: 2.0,
stragegy: new Ext.ux.form.Spinner.NumberStrategy({ strategy: {
xtype: 'number',
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999,
incrementValue: 1, incrementValue: 0.1,
alternateIncrementValue: 1,
decimalPrecision: 1 decimalPrecision: 1
}), },
listeners: { listeners: {
'spin': { 'spin': {
fn: this.onFieldChange, fn: this.onFieldChange,

File diff suppressed because one or more lines are too long

View File

@ -400,7 +400,7 @@ Ext.extend(Ext.ux.form.Spinner.NumberStrategy, Ext.ux.form.Spinner.Strategy, {
if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){ if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
return nan ? '' : value; return nan ? '' : value;
} }
return parseFloat(parseFloat(value).toFixed(this.decimalPrecision)); return value.toFixed(this.decimalPrecision);
} }
}); });

File diff suppressed because one or more lines are too long