Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Adam Downs on Oct 05, 2009 10:11
open dhtmlx forum
Custom Cells with dataprocessor

I have a grid that I created a custom cell for that changes the background based on cell value. This works until I attach the dataprocessor to the grid. Once attached the backgounds no longer change. How can I use the custom cell type with the dataprocessor?

Below is my custom cell code.

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.