search column for string
I have a 2.5.1 application working and seek to add a button and input box under grid. Below is the code being used. Something is wrong.
In this simple app I set the variable text1 to a 3 char string. when the user clicks button1, I want the grid to display only rows where the value of text1 -- as entered by the user -- appear in the grid.
I have something out of sequence? Can someone help?
actually my interest is to then generalize this:
table.getData(4, i).substr(0,3) == text1.substr(0,3)
so that the full string table.getData(4, i) is searched for the exact characters text1.
Thank you.
======>
var text1 =" Al";
function showselected1(){
var i, rows = [];
var max = table.getCount();
for (i=0; i<max; i++){
if (table.getData(4, i).substr(0,3) == text1.substr(0,3)){
rows.push(i);
}
}
obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();
obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
var button1 = new AW.UI.Button;
button1.setControlText("Find in Name:");
button1.onClick = showselected1;
document.write(button1);
var input1 = new AW.UI.Input;
input1.setControlText(text1);
document.write(input1);
In this simple app I set the variable text1 to a 3 char string. when the user clicks button1, I want the grid to display only rows where the value of text1 -- as entered by the user -- appear in the grid.
I have something out of sequence? Can someone help?
actually my interest is to then generalize this:
table.getData(4, i).substr(0,3) == text1.substr(0,3)
so that the full string table.getData(4, i) is searched for the exact characters text1.
Thank you.
======>
var text1 =" Al";
function showselected1(){
var i, rows = [];
var max = table.getCount();
for (i=0; i<max; i++){
if (table.getData(4, i).substr(0,3) == text1.substr(0,3)){
rows.push(i);
}
}
obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();
obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
var button1 = new AW.UI.Button;
button1.setControlText("Find in Name:");
button1.onClick = showselected1;
document.write(button1);
var input1 = new AW.UI.Input;
input1.setControlText(text1);
document.write(input1);
Dave
April 10,