Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Oct 22, 2008 00:58
open dhtmlx forum
Problem: editing custom formated number

I have a number like 12.34 in field defined as "edn" custom formated:

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

to this: 12,34

Now, when I edit cell value to "12,56" it will be cut down to 12, value "12.56" will be parsed correctly.

How can I edit number values with comma separator?
Answer posted by Support on Oct 22, 2008 02:06
The data should be in js-compatible number format - "." is used as separator.
 
There are two possible ways in order to use ",":
 
1) create custom excell. Please, have a look at the article in the documentation:
 
    dhtmlxGrid/doc/articles/Custom_excell_creation.html
 
2) change code of setValue method in edn|ron excell (dhtmlxgridcell.js) - replace of "," to "." in cell's value (setValue method).
 
For example:
 
eXcell_edn.prototype.setValue=function(val){
 if (!val||val.toString()._dhx_trim() == ""){
  val="0"
  this.cell._clearCell=true;
 } else
  this.cell._clearCell=false;
 val =val.replace(",",".");
 this.setCValue(this.grid._aplNF(val, this.cell._cellIndex));

Answer posted on Oct 22, 2008 03:24
I decided to create my own eXcell.

BTW: I found error in documentation dhtmlxGrid/doc/articles/Custom_excell_creation.html

for
function eXcell_button(cell){ 

correct base class definition line is:

eXcell_button.prototype = new eXcell;  (documentatin: eXcell_ro.prototype = new eXcell;)

Same errors for other examples on this page

Answer posted by Support on Oct 22, 2008 08:16
Yep, nasty typo from our side
Online documentation will be updated in nearest time.