:: Forum >>

using two filters

Hoping someone can help me to get two filters to work in this app --
http://23ve4.com/cdrev.htm

It filters correctly on state or on party, but not state ... keep the state filter ... and then filter party. As an example, I want to filter on state=CA, then filter on party=R and have it keep the intersection of CA and R with all other parts of logic as is.

I cannot determine how to keep the subset as defined by state when party is applied. I think I am close, but missing something.

Thank you.
Warren
Thursday, October 15, 2009
Try this :
function applyFilter2(s){
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(1, i).substr(0,1) == s.substr(0,1)){
            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(1,sdd).substr(0,1) == s.substr(0,1)){
            rows.push(sdd);
        }
    }
}
Carlos
Thursday, October 15, 2009
Sorry , is incomplete , just add

obj.clearRowModel();
obj.clearSortModel();
obj.clearScrollModel();

obj.setRowCount(rows.length);
obj.setRowIndices(rows);
}
Carlos
Thursday, October 15, 2009
And change this line also ' ...'

function showAll(){
combo.setControlText("State ..."); // same value as original load
...
Friday, October 16, 2009
Thank you!! That works great. :)
Warren
Friday, October 16, 2009

This topic is archived.


Back to support forum

Forum search