Categories | Question details Back To List | ||||||||
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? Answer posted by Support on Jan 14, 2008 08:45 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. Answer posted by M.Steinböck on Jan 14, 2008 11:04 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? Answer posted by Support on Jan 15, 2008 02:01 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. Attachments (1)
Answer posted by M.Steinböck on Jan 17, 2008 00:17 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. Answer posted by Support on Jan 17, 2008 03:44 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 Answer posted by M.steinböck on Jan 17, 2008 07:35 THX, Problem solved . Answer posted by Hans on May 18, 2008 14:06 Hi! I tried this solution and it seemed to work fine. But, then all dots(.) in all ed cells are replaced with commas(,). Thanks! Answer posted by Support on May 19, 2008 06:22 >>Hi! I tried this solution and it seemed to work fine. >>How can we make sure that this modification only affects numeric cells? |