Has anyone implemented a filtering mechanism applied to a wx.grid object?

Hi,

In MS Excel, you can apply filter to a sheet. Has anyone implemented similar filtering mechanism to a wx.grid object with wxpython? Is there a nice example to examine?

Best regards

steve wrote:

In MS Excel, you can apply filter to a sheet. Has anyone implemented
similar filtering mechanism to a wx.grid object with wxpython? Is
there a nice example to examine?

What do you expect the filter to do?

There's really no magic here. The grid doesn't understand your
content. If you want to show only certain rows, then you need to delete
all the rows and recreate it with only the rows that meet your filter.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Steve,

You would probably find it very easy to implement by using a virtual mode grid and simply setting a filter on which lines you display, sorting can be done very similarly.

Gadget/Steve

···

On 07/07/14 19:23, Tim Roberts wrote:

steve wrote:

In MS Excel, you can apply filter to a sheet. Has anyone implemented
similar filtering mechanism to a wx.grid object with wxpython? Is
there a nice example to examine?

What do you expect the filter to do?

There's really no magic here. The grid doesn't understand your
content. If you want to show only certain rows, then you need to delete
all the rows and recreate it with only the rows that meet your filter.

I have a very simple filter set up as Tim suggests. This works fine, although I may try the virtual mode grid in future. Mine works as follows:

  • Bind the grid’s EVT_GRID_LABEL_RIGHT_CLICK to a function so this is called when you right-click on a column label.
···

On Monday, 7 July 2014 19:50:45 UTC+1, Gadget Steve wrote:

On 07/07/14 19:23, Tim Roberts wrote:

steve wrote:

In MS Excel, you can apply filter to a sheet. Has anyone implemented

similar filtering mechanism to a wx.grid object with wxpython? Is

there a nice example to examine?

What do you expect the filter to do?

There’s really no magic here. The grid doesn’t understand your

content. If you want to show only certain rows, then you need to delete

all the rows and recreate it with only the rows that meet your filter.

Steve,

You would probably find it very easy to implement by using a virtual
mode grid and simply setting a filter on which lines you display,
sorting can be done very similarly.

Gadget/Steve

Set up a unique list of choices from the values in each cell in the selected column (using GetCellValue()), create a wx.Menu and add one item per choice, popup the menu.

  • Get the choice selected by the user and delete any rows from the grid that don’t match.

Removing the filter is done via a separate button - if pressed, the grid is cleared (by deleting all the rows) and repopulated in full from the data source.

Obviously you could add some fancier options …

Jill