3.2.0

comma decimal separator

how can I setCellFormat and setTextformat for numeric fields having comma for decimal separator?
October 13,
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.dataToValue1= number.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(number, 1); // numbers in the second column
    obj.setColumnCount(2);
    obj.setRowCount(5);
    document.write(obj);

obj.onCellClicked = function(event, col,row){
alert(this.getCellValue(col,row) )
}

Please check also:
http://www.activewidgets.com/javascript.forum.22951.1/numeric-sorting-with-comma-as.html

http://www.activewidgets.com/javascript.forum.11471.8/currency-format-not-working.html
C++
October 14,

This topic is archived.

See also:


Back to support forum