Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by S.Sekar on Sep 11, 2008 07:39
open dhtmlx forum
Dynamic Image based on value

Hi

Is it possible to replace a cell content based on the numeric value at the time of loading at client end?
For example, for

Value <50 - blue.png
Value 50 - 75 - green.png
Value 75 - 85 - yellow.png
Value 85 - 95 - amber.png
value >95 - red.png

Similarly, Is it possible to set background/font color of a cell based on value?

Thanks
S.Sekar
Answer posted by Support on Sep 11, 2008 08:10
There are two ways to achieve such functionality
a) use custom excell 

b) use onCellChanged event ( available in pro version of grid 
 mygrid.attachEvent("onCellChanged",function(id,ind,value){
       if (value <50 ) mygrid.cells(id,ind).cell.innerHTML="<img src='blue.png' >";
       if (value >50 ) mygrid.cells(id,ind).cell.innerHTML="<img src='green.png' >";
       ....
 })

for styles it may look as 
      mygrid.cells(id,ind).cell.style.backgroundColor="red"