filter not working
Can someone see what is wrong with this code? It works correctly when (combo.getControlText()=="State ...") but no rows ever show under else condition. Thank you for any thoughts.
function applyFilter2(s2){
if (combo.getControlText()=="State ..."){ // or... if( obj.getRowCount() == table.getCount() )
var i, rows = [];
var max = table.getCount();
for (i=0; i<max; i++){
if (table.getData(3, i).substr(0,3) == s.substr(0,3)){
rows.push(i);
}
}
}
else{ // another filter in use
var i, rows = [], rowsDF = obj.getRowIndices();
var max = rowsDF.length;
for (i=0; i<max; i++){
var sdd = rowsDF[i];
if ( table.getData(3,sdd).substr(0,3) == s.substr(0,3)){
rows.push(sdd);
}
}
}
obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();
obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
function applyFilter2(s2){
if (combo.getControlText()=="State ..."){ // or... if( obj.getRowCount() == table.getCount() )
var i, rows = [];
var max = table.getCount();
for (i=0; i<max; i++){
if (table.getData(3, i).substr(0,3) == s.substr(0,3)){
rows.push(i);
}
}
}
else{ // another filter in use
var i, rows = [], rowsDF = obj.getRowIndices();
var max = rowsDF.length;
for (i=0; i<max; i++){
var sdd = rowsDF[i];
if ( table.getData(3,sdd).substr(0,3) == s.substr(0,3)){
rows.push(sdd);
}
}
}
obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();
obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
Warren
November 5,