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);
}
}
}
}
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.getColumnCount();c++)
{
var cellContent=grd.getCellText(c,r);
var pos=cellContent.indexOf(searchText);
}
if(pos !=-1) break;
}
if(pos !=-1)
{
grd.setSelectionMode("single-row");
grd.setSelectedRows([r]);
grd.setCurrentRow(r);
//grd.setScrollTop( r * grd.getRowHeight()); /// can be used instead of set CurrentRow
}
}
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)
{
var desc = grd.getCellText(1,r);
grd.setSelectionMode(\"single-row\");
grd.setSelectedRows([r]);
grd.setCurrentRow(r);
grd.setScrollTop( r * grd.getRowHeight());
if (confirm('Found : '+searchText+' '+desc+' Continue Searching?'))
{
grd.setSelectionMode(\"single-row\");
grd.setSelectedRows([r]);
grd.setCurrentRow(r);
grd.setScrollTop( r * grd.getRowHeight());
} else {return false;}
}
}
}
}
This topic is archived.