Hi I have an edn column however I do not want the value of 0 being displayed for cells that do no have a value yet. I just want them to be blank so I went and altered the file dhtmlxgridcell.js changing
eXcell_ed;eXcell_edn.prototype.setValue = function(val){if(!val || val.toString()._dhx_trim()==""){val=“0”
to:
eXcell_ed;eXcell_edn.prototype.setValue = function(val){if(!val || val.toString()._dhx_trim()==""){val=""
This works nicely and 0’s are no longer shown where a blank should be…however the edn is a column in a tree and the 2 levels above it use sum which now show n.an
Is there a better way of doing this or should I alter sum as well.
thanks again
Cliff
To fix math functionality you can locate next method in dhtmlxgrid_math.js
dhtmlXGridObject.prototype._countTotal=function(row,cel){
and update it as
dhtmlXGridObject.prototype._countTotal=function(row,cel){
var b=0;
var z=this._h2.get[row];
for (var i=0; i<z.childs.length; i++)
b=b*1+(this.cells(z.childs[i].id,cel).getValue()||0)*1; // << fallback to 0 added
return b;
}
after such update sum functionality must work correctly with empty values
Hi That worked well, however when i enter 0 in the lowest level cell the sum rows do not show 0 they still show blank. anything >than 0 sum correctly.
How do i get the sum cells to show zero when the lowest level cell is entered as zero. PLease see attached screenshot
thanks again
Cliff
The logic which you introduce change any null-like value into empty cell
>>eXcell_ed;eXcell_edn.prototype.setValue = function(val){if(!val
The 0 will trigger such rule and will be converted to empty string as well.
You can’t define one rult for the default value setting and different rule for processing results of math operation.
Probably updating code in next way will resolve problem
eXcell_edn.prototype.setValue = function(val){if((!val && typeof val != “number”)|| val.toString()._dhx_trim()==""){val=""