On Jun 29, 2006, at 6:25 AM, Simen Haugen wrote:

I was looking for some way of filtering a grid, but could not find any.
I remember that WinForms has a concept of views. You can set up a view
towards a datasource, and apply that view to the grid. The view in turn
could accept SQL like filtering commands - "date<='2006-06-29' AND
guilty=1", and the grid would only show this.

This made it easy to implement an excel-like autofilter feature.

I think that implementing something like this would have been a great
addition.

        You don't filter a grid; you filter the grid's DataSet.

Is this something to have at the grid level like explained above where
you set a 'view' on the entire thing, or at the column level?

No; it's in the dabo.db level right now. When you get a data set back from a cursor or bizobj, it's not a standard tuple, but a smart tuple subclass that knows how to run queries against itself. Right now that functionality is limited to inside these classes, but now that SQLite has been made a requirement, I can expose it elsewhere.

The basic idea is that the DataSet class can execute SQL queries against itself and return a new DataSet. Let's say that you used the SimpleFormWithBizobj demo and ran a query that returned all cities beginning with 'Des': I got 82 results, with most of them being 'Des Moines, IA'. Now I can run the following:

>>> ds = self.PrimaryBizobj.getDataSet()
>>> print len(ds)
82
>>> d2 = ds.execute("select * from dataset where cstateprov = 'TX' ")
>>> print len(d2)
6

What I think I'd like to do is add a 'filter()' function to the DataSet class that would retain the original data, but expose just the filtered set. Let me work on that.

You also need a quick way of determining visually if a column has a
filter on it or not.

I'm not sure about the interface details yet - that will come afterwards.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to