:: Forum >>

Simple filtering in grid

Hi,
I wonder if the grid filtering solution I implemented in AW 2.5.5 is the correct one.
It works, I am just worried that I am doing something wrong because it is much simpler then everything I saw here. I initially generate my data in JS array mydata1 (on the server), then just copy it to array mydata:

var mydata=mydata1;

Here's the code for where multiple conditions are 'or'-ed:

function applyfltr(f) {
mydata = [];
myObj.setRowCount(0);
myObj.setCellData(mydata);
myObj.refresh();
// calculate conditions to include rows from field values in form f
// (actually, I inline calculations)
for (i=0;i<mydata1.length;i++) {
if (!condition_to_include1) continue;
if (!condition_to_include2) continue;
// ...
if (!condition_to_includeN) continue;
mydata[j++] = mydata1[i];
}
myObj.setRowCount(mydata.length);
myObj.setCellData(mydata);
myObj.refresh();
}

A button "Apply filter" has onClick="applyfltr(this.form);" clause.

Comments?
Alex Peshansky
Friday, April 9, 2010
Depends if you also want to clear the current selection and sort order - otherwise yes, it should be that simple.
Alex (ActiveWidgets)
Wednesday, April 14, 2010

This topic is archived.


Back to support forum

Forum search