Categories | Question details Back To List | ||||||||
Sum with edn 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 Answer posted by Support on May 08, 2008 09:31 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 Answer posted on May 08, 2008 22:52 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 Attachments (1)
Answer posted by Support on May 15, 2008 08:03 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. 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="" |