Categories | Question details Back To List | ||
edit cell with custom color Hi, ive read here, that in order to customize font color in a cell is by putting html tags like ""<span style='color:red'>" + value+ "</span>"" as value of the cell.. my problem is, i have created some sort of custom cell type, its like a price type, except it accepts commas..or automatically converts value to comma format numbers. my problem is if the number is negative, i placed the html code (span tag) to change color, the cell by the way is ed(editable), and try to edit the cell, the span tag also is part of the value being edited, what i would like to do is edit the value only not the html tags.. please help.. thanks in advance.. Answer posted by Support on Mar 28, 2008 03:16 The excell has two main methods obj.setValue(... obj.getValue(... By default first just set innerHTML of value , and second gets it this.setValue=function(val){ this.cell.innerHTML=val; } this.getValue=function(){ return this.cell.innerHTML; } If you are using custom tags inside cell to apply colors you need to update getValue method, so it can locate data part of cell this.setValue=function(val){ this.cell.innerHTML="<span style='color:red'>"+val+"<span>"; } this.getValue=function(){ return this.cell.childNodes[0].innerHTML; } Basically you can set custom color without using any additional tags this.cell.style.color="red"; in such case you will need not getValue customization |