Hy,
My problem is this:
For float numbers I need to set the decimal point to , and thousands point to .
I need to this only in 2 situations: when I display it and when the user edits it.
The rest of the time it should be as it is normal ( dot for decimal point and comma for thousands point)
For displaying it I've started from ledfini money data type:
http://forums.smartclient.com/showth...ighlight=money
I've done some minor adjustments:
But when I'm trying to edit everything goes wrong.
Any help would be great.
Thanks,
John
My problem is this:
For float numbers I need to set the decimal point to , and thousands point to .
I need to this only in 2 situations: when I display it and when the user edits it.
The rest of the time it should be as it is normal ( dot for decimal point and comma for thousands point)
For displaying it I've started from ledfini money data type:
http://forums.smartclient.com/showth...ighlight=money
I've done some minor adjustments:
Code:
isc.SimpleType.create({
name:"currency",inheritsFrom:"float",
normalDisplayFormatter: function(value) {
return this.shortDisplayFormatter(value);
},
shortDisplayFormatter: function(value) {
// US currency formatter from http://javascript.internet.com/forms/currency-format.html
if (value==undefined)
return value;
else {
value = value.toString().replace(/\$|\./g,'');
if(isNaN(value))
value = "0";
sign = (value == (value = Math.abs(value)));
value = Math.floor(value*100+0.50000000001);
cents = value%100;
value = Math.floor(value/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((value.length-(1+i))/3); i++)
value = value.substring(0,value.length-(4*i+3))+'.'+value.substring(value.length-(4*i+3));
return (((sign)?'':'-') + value + ',' + cents);
}
}
});
Any help would be great.
Thanks,
John
Comment