:: Forum >> Version 2 >>

comma decimal separator

how can I setCellFormat and setTextformat for numeric fields having comma for decimal separator?
Wednesday, October 13, 2010
If you just need to display data "as it comes" creating numeric values for sorting , then this example could help.
But if also need to display "thousands" separator, then you need to build a custom special format based on number.
var myData = [
        [
"Number formats""123456,889"],
         [
"Number formats""123456,78901"],
          [
"Number formats""123456,7890"],
           [
"Number formats""123456,78"],
            [
"Number formats""23456,78"]
    ];

var 
number = new AW.Formats.Number;

number.dataToValue1number.dataToValue;
number.dataToValue=function(v){ 
v=v.replace(/\,/gi"."
return 
this.dataToValue1(v)
};

//     number.setTextFormat("#.###,");
           
    // grid control
    
var obj = new AW.UI.Grid;
    
obj.setCellData(myData);
    
obj.setCellFormat(number1); // numbers in the second column
    
obj.setColumnCount(2);
    
obj.setRowCount(5);
    
document.write(obj);

obj.onCellClicked = function(eventcol,row){
alert(this.getCellValue(col,row) )
}
 
Please check also:
/javascript.forum.22951.1/numeric-sorting-with-comma-as.html

/javascript.forum.11471.8/currency-format-not-working.html
C++
Thursday, October 14, 2010



This topic is archived.

Back to support forum

Forum search