Cells appear to be processed twice when used colspan

Hi,

Our model has various cells that are base64 encoded (see below).
Some of the rows have a colspan set to greater than one.
I’ve written a custom excell object to handle the decoding of the cells value inside the setvalue function.
However the setvalue() is called n times for each cell where colspan is n.
The problem is that it appears a new cell is passed through every time, however the textContent is persisted, which means that the final text is encoded more than once!

I can implement non-dhtmlxgrid solutions, however I cannot find an elegant framework based solution to this problem.

MTIzNA== ZG9tYWluNy5jby51ay4== MzYwMA== 0

function eXcell_edbase64(cell){
if (cell){
this.cell = cell;
this.grid = this.cell.parentNode.grid;
eXcell_ed.call(this);
}

this.setValue = function(val){
if (!this.initialised) {
// this gets called twice by a cell object with a colspan of 2
//The first time the cells textContent is MTIzNA==
//The second time the cells textContext is 1234
var decodedVal = BASE64.decode(val);
this.setCTxtValue(decodedVal,decodedVal);
// First time the decodedVal is 1234, and sets the cells textContent to 1234
// Second time the cells decodelVal becomes munged
}
}

this.getValue = function(){
var val = this.cell.textContent;
if (val == undefined) {
val = this.cell.innerText;
}

 return val;

}

this.detach=function(){
var val = this.cell.childNodes[0].value;
if (val == undefined) {
val = this.cell.innerText;
}

 this.setValue(BASE64.encode(val));
    return this.val!=this.getValue();    // compare the new and the old values
 }                   

}

eXcell_edbase64.prototype = new eXcell;

Thanks
DD.

I’m not quite sure that problem caused by colspan, because colspans are applied after initial data rendering, so there must not be double calls for the same cell.
On other hand - grid has many other scenarios where setValue can be called twice for the cell. ( split mode for example )

You can change your code as

f (!this.cell.initialised) { var decodedVal = BASE64.decode(val); this.setCTxtValue(decodedVal,decodedVal); this.cell.initialised = true; }

it will guarantee, that this block of code will be called only once per cell