3.2.0

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);
}
Warren
November 5,
try this one , not using max variable in else seach , this post could help as a second var 'max2' should be needed to store the original rowcount
http://www.activewidgets.com/javascript.forum.22570.11/need-help-with-filter-based.html

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) == s2.substr(0,3)){
rows.push(i);
}
}
}
else{ // another filter in use
var i, rows = [], rowsDF = obj.getRowIndices();

for (i=0; i<rowsDF.length ; i++){
var sdd = rowsDF[i];
if ( table.getData(3,sdd).substr(0,3) == s2.substr(0,3)){
rows.push(sdd);
}
}
}
obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();

obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
November 5,

This topic is archived.

See also:


Back to support forum