I tried to use this example, to change the decimal separator from “.” to “,”
http://stackoverflow.com/questions/9276375/jqgrid-number-format-with-comma-as-decimal-point
Here’s my code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$grid->setColProperty('hourlyrate', array("label"=>"Rate (€)", "width"=>"40", "fixed"=>true, "align"=>"right", "formatter"=>"js:numFormat", "unformat"=>"js:numUnformat")); $custom = <<<CUSTOM ... other functions here function numFormat(cellvalue, options, rowObject){ return cellvalue.replace(".",","); } function numUnformat(cellvalue, options, rowObject){ return cellvalue.replace(",","."); } CUSTOM; $grid->setJSCode($custom); |
In the grid, the numbers appear with “,” as decimal separators, but in edit mode it still requires “.” as decimal separator, which leads me to believe that the unformat function is not working or is incorrect.
What is the correct method of introducing numbers with a comma as decimal separator?
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top