BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
<ej-grid id="FlatGrid" datasource="ViewBag.datasource" allow-paging="true" query-cell-info="onQuerycellInfo">
<e-columns>
. . .
<e-column field="RGB" header-text="RGB" text-align="Left" width="75"></e-column>
</e-columns>
</ej-grid>
<script type="text/javascript">
function onQuerycellInfo(args) {
if (args.column.field == "RGB") {
var val = args.text.split(",");
var str = "#" + componentToHex(parseInt(val[0])) + componentToHex(parseInt(val[1])) + componentToHex(parseInt(val[2]));
args.cell.bgColor = str; //change the background color based on hex code
$(args.cell).css("color", "white");
}
}
function componentToHex(c) {
//Algorithm to convert rgb value to hex code.
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
}
</script> |
Thank you for the prompt reply. As usual superb support!!!!
Thank you
George