3.0.5

How to reverse filtering of rows

I am reformulating my question, which seemed to be unclear:

obj.setProperty("row/values", [0,1,4]);
obj.refresh();


allows to only display in a table or grid the rows specified in the array, i.e. it filters out all other rows.

Is there an easy way to reverse that filtering so all rows are displayed again ("show all")?

The only way I can come up with is to pass in an array with all rows listed, which seems to be awkward.

Thanks in advance for any help with that.
Andreas
March 18,
I still haven't figured out a better way to do it, but I am sure there must be one, so I am posting this to have the question bubbling up again.

Maybe someone reading this now has an idea?
Andreas
March 25,
No, there is no 'show all' method, so the only way is to assign an array of all indices.

var i, count = 20, a = [];
    for (i=0;i<count;i++){a[i]=i}
    obj.setRowValues(a);
    obj.refresh();
Alex (ActiveWidgets)
March 25,
Ok, I follow this. But, Alex, you re fixing the count at 20. How do I get the actual number of rows in the array so I can re-assign the row indices? Some datasets have 5 rows, some have 17, some have 50, some have 2000.

How do I get the original number of rows read into the grid?
I've been looking through code trying to figure out which array XML data is stored in so I can get an arrany length.

Maybe I'm just over thinking this. But I'd like someone's thoughts.
Carl
February 12,
Carl,

In version 2.0 you can...

Restrict the grid to desired rows using:
obj.setRowIndices([1,4,6]);

Then later show all rows again using:
obj.setRowIndices("");

However, this doesn't help you if you are using version 1.
Rob Francis
February 12,
I'm actually playing with b4 of ActiveWidgets so I can justify the purchase of it for use within our company (corporate web site).

I'm using an XML data source. And using the filtering script Alex had posted previously, I'm trying to modify it to remember the original row count so when I click on a different filter, it will re-evaluate the data set.

Below is the code, I'm fairly new to js, so I might be implementing the changes incorrectly. I did add the obj you showed me, but it still doesn't seem to work.
I can post the entire page some place if you'd like to take a look at it and see what I'm trying to accomplish. Basically, column 11 has a bunch of different fuel-types in it. If they click on the "wood" icon in the legend, I only want it to show "wood". But then after that, if they click on "nueclear", I want it to re-eval the data set and display "nuclear" in the grid.
Actually, posted here is the example I'm working on and it has the filter code in it (along with a ton of corporate branding crap (grin)). Any ideas would be great.

http://www.schiavoni.com/ActiveWidgets/examples/old/pages-1.htm


function fuelfilter(jsStr) {
obj.setRowIndices("");
var i, cellvalue, rows = [], max = obj.getRowCount();
for (i=0; i<max+1; i++){
cellvalue = obj.getCellValue(11,i);
if (cellvalue == jsStr) {
rows.push(i);
}
}
obj.setRowCount(rows.length);
obj.setRowIndices(rows);
obj.refresh();
}
Carl
February 12,
Never mind ... I got it.
Carl
February 12,

This topic is archived.

See also:


Back to support forum