Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Thulasi on Dec 03, 2008 12:59
open dhtmlx forum
Grid column with numberFormat

I am using dhtmxgrid with one of the columns named Amount. This column should show the amount in currency format and so using
transGrid.setNumberFormat("0,000.00",1) on that column. The issue is if the amount value is blank or null, it is showing as 0.00. I want the value to show as blank and not zero if it is really not zero.

Thank you.
Answer posted by Support on Dec 04, 2008 02:45
This is default behavior of grid and can be changed only with code modification of per cell typing

a) code modificaton
dhtmxlgridcell.js
eXcell_edn.prototype.setValue=function(val){ 
 if (!val||val.toString()._dhx_trim() == ""){
  val="0"
  this.cell._clearCell=true;

can be replaced with 
eXcell_edn.prototype.setValue=function(val){ 
 if (!val||val.toString()._dhx_trim() == ""){
  this.cell._clearCell=true;
  return this.setCValue("&nbsp","");



b) per cell typing solution 
   <row ...><cell>1.23</cell></row>
   <row ...><cell type="ro"></cell></row> // <= will be rendered as empty cell without formatting