Checkbox Value to Y/N rather than 0/1

Hi,

You kindly emailed me the beta ASP connector for use on the dhtmlxGrid. I’ve followed the step by step guides and so far so good (it’s all working) but I’m stuck on the following.

My checkboxes are stored in my (MySQL) database as Y or N but if I change them in the grid it stores either 0 or 1 - is there anyway I can change it to be Y or N?

Many thanks.

If you don’t need checkboxes you can use “ro” eXcell type. This column will have “Y” or “N” values base on what comes from server side.

Hi,

Thanks, but I wanted the checkbox look because it’s so easy to edit/change.

I fiddled with dhtmlxgridcell.js and changed the values of 0 and 1 to Y and N in the following code (line 61 to 81) and it seems to be working:

[code]if (this.val == “Y”)this.setValue(“N”)
else
this.setValue(“Y”)

this.cell.wasChanged=true;this.grid.callEvent(“onEditCell”, [
1,
this.cell.parentNode.idd,
this.cell._cellIndex
]);this.grid.callEvent(“onCheckbox”, [
this.cell.parentNode.idd,
this.cell._cellIndex,
(this.val != ‘Y’)
]);this.grid.callEvent(“onCheck”, [
this.cell.parentNode.idd,
this.cell._cellIndex,
(this.val != ‘Y’)
])}else {this.editor=null}};this.getValue=function(){return this.cell.chstate ? this.cell.chstate.toString() : “N”};this.isCheckbox=function(){return true};this.isChecked=function(){if (this.getValue()== “Y”)
return true;else
return false};this.setChecked=function(fl){this.setValue(fl.toString())
};this.detach=function(){return this.val != this.getValue()};this.edit=null};eXcell_ch.prototype=new eXcell;eXcell_ch.prototype.setValue=function(val){this.cell.style.verticalAlign=“middle”;if (val){val=val.toString()._dhx_trim();if ((val == “false”)||(val == “N”))
val=""};if (val){val=“1”;this.cell.chstate=“Y”}else {val=“0”;this.cell.chstate=“N”[/code]

Any reason why this is not a good idea (BTW I don’t plan on using SELECTS or RADIO buttons)

This is correct approach. “ch” eXcell type expected 0 or 1 from server side. You can change it by modification of getValue()/setValue() method of the cell.
Please find more information about custom eXcell types here docs.dhtmlx.com/doku.php?id=dhtm … l_creation