Ext.define('Ext.ux.form.field.DecimalNumber', {
	
	extend: 'Ext.form.field.Number',
	
	alias: ['widget.decimalnumber'],
	
	forcePrecision: false,

	initComponent: function () {

		var i_cmp = this;

		i_cmp.callParent(arguments);

		return i_cmp;
	},

	valueToRaw: function(value) {
		
		var me = this;
		var decimalSeparator = me.decimalSeparator;
		
		value = me.parseValue(value);
		value = me.fixPrecision(value);
		value = Ext.isNumber(value) ? value : parseFloat(String(value).replace(decimalSeparator, '.'));
		
		if (isNaN(value)) {
			value = '';
		}
		else {
			value = me.forcePrecision ? value.toFixed(me.decimalPrecision) : parseFloat(value);
			value = String(value).replace(".", decimalSeparator);
		}
		
		return value;
	}
});
