Bug or documentation suggestion RE: event handlers

My grid has a simple combobox that has 3 possible values yet when I was changing it they would display only their key values, not their text values. After about 30 minutes of looking at my code I finally realised it started happening after I added the onEditCell handler. That confused me a great deal because the code of the handler was only meant for another text cell and I had to step through your code to determine why it was interfering with the combo box.



Finally it was apparent, my custom function wasn’t returning a value and the line in dhtmlXGrid.js:



} else if (!z) {

gg.setLabel ? “setLabel” : “setValue”;

}



of



function () {

if (_isOpera) {

if (this._Opera_stop) {

if (this._Opera_stop * 1 + 50 > (new Date).valueOf()) {

return;

}

this._Opera_stop = null;

}

}

if (this.editor && this.editor != null) {

this.cell.className = this.cell.className.replace(“editable”, “”);

if (this.editor.detach()) {

this.cell.wasChanged = true;

}

var g = this.editor;

this.editor = null;

var z = this.callEvent(“onEditCell”, [2, this.row.idd, this.cell._cellIndex, g.getValue(), g.val]);

if (typeof z == “string” || typeof z == “number”) {

gg.setLabel ? “setLabel” : “setValue”;

} else if (!z) {

gg.setLabel ? “setLabel” : “setValue”;

}

}

}



was to blame, because my function was not returning a value it was assuming z was false and then setting the text value of the combobox to the key value. I’m not sure if this is considered a bug or simply needing extra documentation.



Cheers,

Jared

We will add it to documentation more clearly in next version.
Currently all blocable event will be blocked if no value returned. To allow blocable event you need to return exactly true.