dhtmlxgrid custom decimal and date formats

I could not find settings for german decimal points, and e.g. iso-date-formatting in the grid. How could i set input (and display-)format of numbers to , as decimal point, and dot as thousands-mark?

The setNumberFormat allow to set custom chars as group|decimal separators, for example

    grid.setNumberFormat(“0,000.00”,1,".",",");

will set mask where comma used as decimal point, and point used as a group separator.

yes, BUT i think you mixed it up, thrd param. is the decimal separator, and the last one the thousands group char, and - this is more important, i still have to use DOT to input a decimal separator, which is not common in german-speaking countries …
Any (more) solutions?

Yes, I placed parameters in incorrect order. The correct is

    grid.setNumberFormat(“0,000.00”,1,“,”,“.”);

In such case grid will show data in necessary format, but it will use original data format as inner cell value.
Please check attached sample.

1200391755.zip (73.2 KB)

Thanks, but it still has the same problem - the common german decimal separator is “,” (comma) not . (dot) so - during edit-mode a number has to be displayed like “1234567,89” (with or without thousands-separator) and (only) “,” has to be accepted as decimal separator.
I found something like “build your own editor” in your documentation - maybe this could be a solution?
Regards, M.S.

Any type of data transformation can be achieved by custom excells, but as more simple way, if you need the “,” for all edn cells you can just update code in next way ( it need to be used with previously mentioned formatting command )


dhtmlxgridcell.js

function eXcell_ed(cell){
    …
    this.edit = function(){
                    this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF))?“INPUT”:“TEXTAREA”;
                    this.val = this.getValue();
                    this.val=this.val.toString().replace(".",","); // << this line added

function eXcell_edn(cell){
    …
    this.detach = function(){
                    var tv=this.obj.value;
                     tv=tv.toString().replace(",","."); //<< this line added
                   

THX, Problem solved .


Hi! I tried this solution and it seemed to work fine. But, then all dots(.) in all ed cells are replaced with commas(,).
For example www.google.com becomes “www,google,com” when entering a cell.

How can we make sure that this modification only affects numeric cells?



Thanks!


>>Hi! I tried this solution and it seemed to work fine.
The solution with setNumberFormat is a better way to format cell values ( it not requires code modification )



>>How can we make sure that this modification only affects numeric cells?
The modification affects any cells of “edn” type.
You can use edn type for numeric columns and ed type for text ones
Basically it possible to extend logic, so code will check is it number, before replacing commas - I can provide details if you interested - but usage of separate column types seems as better solution.