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?
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;
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));
}
this.setCValue(this.grid._aplNF(val, this.cell._cellIndex));
}
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
Yep, nasty typo from our side
Online documentation will be updated in nearest time.