How can I filter on more than one column
Is there a function to filter data in multiple columns?
I have found the following code but this only works for one column.
function FilterGrid()
{
var myData =[];
resetRowValuesGrid1()
var searchcol = document.forms['gridSearchForm'].colSearchName;
var colToBeSearched = searchcol.options[searchcol.selectedIndex].value ;
var toSearch = document.forms['gridSearchForm'].keyword.value;
var rowidValues = [];
var res = 0;
for(var x=0; x<GlobData.length; x++)
{
if((GlobData[x][colToBeSearched].indexOf(toSearch)) >= 0) {
myData.push(GlobData[x]);
res++;
}
}
obj.sort(0, "ascending");
resfilter = res;
obj.setModel("row", new Active.Rows.Page);
obj.setRowProperty("count", resfilter);
obj.setColumnProperty("count", 12);
obj.getDataText = function(i, j){return myData[i][j]};
obj.setDataText = function(value, i, j){myData[i][j] = value};
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setProperty("row/pageSize", 24);
obj.setAction("selectionChanged", message);
goToPage(0);
document.getElementById('result').innerHTML = "<b>Number of matches : "+resfilter+" of: " + restot +"</b>";
}
['gridSearchForm'].colSearchName.value;
var toSearch = document.forms['gridSearchForm'].keyword.value;
var rowidValues = [];
var res = 0;
for(var x=0; x<GlobData.length; x++)
{
if((GlobData[x][colToBeSearched].indexOf(toSearch)) >= 0) {
myData.push(GlobData[x]);
res++;
}
}
obj.sort(0, "ascending");
resfilter = res;
obj.setModel("row", new Active.Rows.Page);
obj.setRowProperty("count", resfilter);
obj.setColumnProperty("count", 12);
obj.getDataText = function(i, j){return myData[i][j]};
obj.setDataText = function(value, i, j){myData[i][j] = value};
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setProperty("row/pageSize", 24);
obj.setAction("selectionChanged", message);
goToPage(0);
document.getElementById('result').innerHTML = "<b>Number of matches : "+resfilter+" of: " + restot +"</b>";
}
I have found the following code but this only works for one column.
function FilterGrid()
{
var myData =[];
resetRowValuesGrid1()
var searchcol = document.forms['gridSearchForm'].colSearchName;
var colToBeSearched = searchcol.options[searchcol.selectedIndex].value ;
var toSearch = document.forms['gridSearchForm'].keyword.value;
var rowidValues = [];
var res = 0;
for(var x=0; x<GlobData.length; x++)
{
if((GlobData[x][colToBeSearched].indexOf(toSearch)) >= 0) {
myData.push(GlobData[x]);
res++;
}
}
obj.sort(0, "ascending");
resfilter = res;
obj.setModel("row", new Active.Rows.Page);
obj.setRowProperty("count", resfilter);
obj.setColumnProperty("count", 12);
obj.getDataText = function(i, j){return myData[i][j]};
obj.setDataText = function(value, i, j){myData[i][j] = value};
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setProperty("row/pageSize", 24);
obj.setAction("selectionChanged", message);
goToPage(0);
document.getElementById('result').innerHTML = "<b>Number of matches : "+resfilter+" of: " + restot +"</b>";
}
['gridSearchForm'].colSearchName.value;
var toSearch = document.forms['gridSearchForm'].keyword.value;
var rowidValues = [];
var res = 0;
for(var x=0; x<GlobData.length; x++)
{
if((GlobData[x][colToBeSearched].indexOf(toSearch)) >= 0) {
myData.push(GlobData[x]);
res++;
}
}
obj.sort(0, "ascending");
resfilter = res;
obj.setModel("row", new Active.Rows.Page);
obj.setRowProperty("count", resfilter);
obj.setColumnProperty("count", 12);
obj.getDataText = function(i, j){return myData[i][j]};
obj.setDataText = function(value, i, j){myData[i][j] = value};
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.setProperty("row/pageSize", 24);
obj.setAction("selectionChanged", message);
goToPage(0);
document.getElementById('result').innerHTML = "<b>Number of matches : "+resfilter+" of: " + restot +"</b>";
}
Andy
March 2,