Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Francillo on Jun 29, 2009 13:11
open dhtmlx forum
How to use comma as decimal separator?

Hi,
Only the dot seams to be supported in the grid. Is there a way to use comma instead (according that app is localized)

Regards

Francillo
Answer posted by dhxSupport on Jun 30, 2009 01:56
You can change default delimiter used in grid using method setDelimiter(delim) method:
 mygrid.setDelimiter(";");
After that line you can use:
 mygrid.setHeader("First Column;Second Column;Third Column");
Answer posted by francillo on Jun 30, 2009 02:35
Hi,
My answer was not very complete and clear, excuse me.

My answer is about numbers.
When I display a cell typed double (or float), only the dot is used as separator. The same idea, when I edit the cell, I must use a dot as a separator.

Regards


Francillo
Answer posted by francillo on Jun 30, 2009 02:35
Hi,
My answer was not very complete and clear, excuse me.

My answer is about numbers.
When I display a cell typed double (or float), only the dot is used as separator. The same idea, when I edit the cell, I must use a dot as a separator.

Regards


Francillo
Answer posted by dhxSupport on Jun 30, 2009 04:21
You can use setNumberFormat(mask, cInd, p_sep, d_sep) to change default decimal separator:
mask - numeric mask; for example 0,000.00 - 1,234.56
cInd - column index
p_sep - char used as decimal separator ( point by default )
d_sep - char used as groups part separator ( comma by default )

mygrid.setNumberFormat("0,000.00",index,",","");

Note that this function will not change number format when cell is in edit mode. It can be changed only by implementing custom eXcell type. Please see more information here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_excell_creation.html#grid_cexc

Answer posted by francillo on Jun 30, 2009 04:51
Is there a way to set these separators by XML? (I use XML header and it overrides setted values at table init).

Rgds

Francillo
Answer posted by dhxSupport on Jun 30, 2009 05:44
You can call this method from xml using:
<head>
....
<beforeInit>
  <call command="setNumberFormat"><param>0,000.00</param>
  <param>0</param>
  <param>,</param>
  <param><![CDATA[]]></param>
  </call>
  </beforeInit>
</head>