You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by JohnRodey <ti...@yahoo.com> on 2011/09/30 00:06:51 UTC

Filter rows from a table view

I am displaying a list of data in a TableView.  Now I want to apply a filter
to only allow certain data from within that list to be displayed on the
TableView, without actually removing those entries from the list.

I have to imagine there is an easy way to do this?  Is there filter class
that I can set to the tableview?  I tried the DisabledRowFilter, but looks
like that just disables the row and doesn't actually remove it from the
view.

Thanks!

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Filter-rows-from-a-table-view-tp3380655p3380655.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Filter rows from a table view

Posted by Greg Brown <gk...@verizon.net>.
There used to be a FilteredList class, but it was dropped (for 2.0 I think, or maybe earlier). We dropped it because it was conducive to memory leaks but also because this type of functionality is fairly easy to implement in app code.
G

On Sep 29, 2011, at 6:22 PM, JohnRodey wrote:

> Thanks greg!
> 
> Is there a possibly to add in the future a way to apply a filter class that
> would just simply determine whether that row gets painted?  Or is that not
> the design?
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Filter-rows-from-a-table-view-tp3380655p3380684.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Filter rows from a table view

Posted by JohnRodey <ti...@yahoo.com>.
Thanks greg!

Is there a possibly to add in the future a way to apply a filter class that
would just simply determine whether that row gets painted?  Or is that not
the design?

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Filter-rows-from-a-table-view-tp3380655p3380684.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Filter rows from a table view

Posted by Greg Brown <gk...@verizon.net>.
You have to actually remove the data from the list. Otherwise, TableView wouldn't be able to efficiently map row indexes to item indexes in the backing list (for painting, hit detection, etc.).

Easiest way to do this is to create a copy of your source list that represents the filtered contents. That way you can easily revert to the source list if the user clears the filter.

On Sep 29, 2011, at 6:06 PM, JohnRodey wrote:

> I am displaying a list of data in a TableView.  Now I want to apply a filter
> to only allow certain data from within that list to be displayed on the
> TableView, without actually removing those entries from the list.
> 
> I have to imagine there is an easy way to do this?  Is there filter class
> that I can set to the tableview?  I tried the DisabledRowFilter, but looks
> like that just disables the row and doesn't actually remove it from the
> view.
> 
> Thanks!
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Filter-rows-from-a-table-view-tp3380655p3380655.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.