Highlighting letters in the Grid challenge
Dear All,
I am performing an incremental search on the grid and am able to highlight the column i am performing the search on.
This is the code for highlighting based on a row value. However i want to highlight just the letter which i typed. How do i do that. I am populating the grid using XML dynamically.
var stringToFind = document.getElementById(searchIn).value.toUpperCase();
var xmlDoc = table.getXML();
var nodes = xmlDoc.selectNodes("//document/report/" + colToBeSearched);
var matchingRows = new Array();
// Retreive the Column selected to search on
var colIndex = document.getElementById('listColumns').selectedIndex;
//alert(colIndex);
for(i=0;i<nodes.length;i++)
{
var s = nodes[i].text.toUpperCase();
if (s.match(stringToFind))
{
matchingRows.push( i );
}
if(!s.match(stringToFind))
{
obj.getColumnTemplate(colIndex + 1).setStyle("color", "blue");
}
else
{
obj.getColumnTemplate(colIndex + 1).setStyle("color", "black");
}
}
obj.setRowCount(matchingRows.length);
obj.setRowValues(matchingRows);
obj.refresh();
Regards,
Lols
I am performing an incremental search on the grid and am able to highlight the column i am performing the search on.
This is the code for highlighting based on a row value. However i want to highlight just the letter which i typed. How do i do that. I am populating the grid using XML dynamically.
var stringToFind = document.getElementById(searchIn).value.toUpperCase();
var xmlDoc = table.getXML();
var nodes = xmlDoc.selectNodes("//document/report/" + colToBeSearched);
var matchingRows = new Array();
// Retreive the Column selected to search on
var colIndex = document.getElementById('listColumns').selectedIndex;
//alert(colIndex);
for(i=0;i<nodes.length;i++)
{
var s = nodes[i].text.toUpperCase();
if (s.match(stringToFind))
{
matchingRows.push( i );
}
if(!s.match(stringToFind))
{
obj.getColumnTemplate(colIndex + 1).setStyle("color", "blue");
}
else
{
obj.getColumnTemplate(colIndex + 1).setStyle("color", "black");
}
}
obj.setRowCount(matchingRows.length);
obj.setRowValues(matchingRows);
obj.refresh();
Regards,
Lols
Lols
February 14,