Categories | Question details Back To List | ||
Custom Cells with dataprocessor I have a grid with a custom cell type (code below) that changes the cells background color based on inputted value. This works great until I attach a dataprocessor to the grid then It no longer changes the background color. I am using v.2.1 build 90226 How can I change the cells background while using a dataprocessor? Thanks in advance, function eXcell_colors(cell){ if (cell){ this.cell=cell; this.grid=this.cell.parentNode.grid; } this.getValue=function(){ //this.grid.editStop(); if ((this.cell.firstChild)&&(this.cell.firstChild.tagName == "TEXTAREA")) return this.cell.firstChild.value; if (this.cell._clearCell) return ""; return this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex); } this.detach=function(){ var tv = this.obj.value; this.setValue(tv); return this.val != this.getValue(); } } eXcell_colors.prototype=new eXcell_ed; eXcell_colors.prototype.setValue=function(val){ if (!val||val.toString()._dhx_trim() == ""){ val="0" this.cell._clearCell=true; } else this.cell._clearCell=false; this.setCValue(this.grid._aplNF(val, this.cell._cellIndex)); if (val==0) this.cell.style.backgroundColor=""; else if(val==1)this.cell.style.backgroundColor="green"; else if(val==2)this.cell.style.backgroundColor="blue"; else if(val==3)this.cell.style.backgroundColor="purple"; else if(val==4)this.cell.style.backgroundColor="yellow"; else if(val==5)this.cell.style.backgroundColor="orange"; else if(val==6)this.cell.style.backgroundColor="cyan"; else if(val==7)this.cell.style.backgroundColor="pink"; else if(val==8)this.cell.style.backgroundColor="grey"; else if(val==9)this.cell.style.backgroundColor="darkseagreen"; else this.cell.style.backgroundColor="red"; } Answer posted by Stanislav (support) on Oct 06, 2009 01:48 The dataprocessor must not block normal cell coloring in your case, but during row update it may reset colors to normal state. As possible workaround you can block code of dataprocessor, which changes the look of updated row, by using the next code dp.attachEvent("onRowMark",function(){ return false; }) where dp - an instance of dataprocessor. |