Search Grid Function
I have a function that searches a grid for text and when it finds the text highlights the Row.
However how do I set the focus to this row?? Because if the dataset has a lot of Rows that forces scroll bars and the function finds the text at the bottom of the grid, its leaving the focus at the top of the Grid and I would like the focus to jump to the Row where it has found the text it was searching for...??
Please help
However how do I set the focus to this row?? Because if the dataset has a lot of Rows that forces scroll bars and the function finds the text at the bottom of the grid, its leaving the focus at the top of the Grid and I would like the focus to jump to the Row where it has found the text it was searching for...??
Please help
var SearchBox = new AW.UI.Input;
SearchBox.setStyle("Width","250px");
var Search = new AW.UI.Button;
Search.setStyle('width','100px');
Search.setControlText('Search');
Search.onControlClicked = function(event){
var searchText = SearchBox.getControlText();
if(searchText=='') return false;
for(var r=0;r<grd.getRowCount();r++)
{
for(var c=0;c<grd.getRowCount();c++)
{
var cellContent=grd.getCellText(c,r);
var pos=cellContent.indexOf(searchText);
if(pos !=-1)
{
grd.setSelectionMode("single-row");
grd.setSelectedRows([r]);
grd.setCurrentRow(r);
grd.setScrollTop(r);
}
}
}
}
Jez
March 16,