I have created a search Javascript search function based on an Infragisitics sample and it is working well. However the rows in my ultrawebgrid are formatted conditionally with different background colors if they meet certain critera. When the search string is found it highlights the string in Green. However when the user clicks find next it remains highlighted. I would like the original highlighting restored but I keep getting Javascript Errors. Here is my code:
<script language="javascript" type="text/javascript">
<!--
var oCell;
var oCellBackColor;
function Button1_onclick() {
var searchText=document.getElementById("TextBox1").value;
var grid=igtbl_getGridById("UltraWebGrid1");
var re = new RegExp( searchText , "gi");
{
oCell = grid.find(re);
var rowid=oCell.Row.Id;
oCellBackColor = oCell.Element.style.backgroundColor; IT IS ERRORING HERE
}
oCell.Element.style.backgroundColor=oCellBackColor;
var oCell1= grid.findNext(re);
oCell = oCell1;
// -->
</script>
Any Help is much appreciated.
I think you are right. How do I check to see if the cell is inheriting from the parent?
Also if there is code to capture the row background color that would work too. I tried:
oCellBackColor = oCell.Row.style.backgroundColor;
but I got "oCellBackColor is null or not an object"
Thanks
The cell may have null background. Check if it is inheriting it from its parent element.