473,737 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Advanced Treeview Filtering Help

Hi you all,

I am developping a python application which connects to a database
(postresql) and displays the query results on a treeview. In adittion to
displaying the info i do need to implement filtering facility for all the
columns of the treestore/liststore model in order to allow the user an easy
search method to find the desired information.

The treestore is created with information related to cars, the columns are:

car_model car_year car_color car_type car_price
chevrolet 1998 white sedan 5.000 US$
ford 1996 blue sedan 3.000 US$
- - - - -
- - - - -
- - - - -

I have been able to allow filtering to only one column, an extract of my
code as follows:
------------------------------------------------------------------------------------------------------------------------
#treestore creation
self.treestore = gtk.TreeStore(s tr, str, str, str, str)
self.modelfilte r = self.treestore. filter_new()
self.treeview=g tk.TreeView()

#append treestore columns
self.treestore. append(None, [self.model, self.year, self.color,
self.type, self.price]

#set treestore model to allow filtering by car_model column
self.modelfilte r.set_visible_f unc(self.visibl e_cd, self.car_model)

#the function to filter the treestore
def visible_cb(self , treestore, iter, x)
return treestore.get_v alue(iter, 0) in x

#self.car_model is a list of items wich change according to user needs and
can be controlled by a #secundary treeview or a button this function is
not explained.

------------------------------------------------------------------------------------------------------------------------

The code mentioned above does work but i can only fllter by defining
criterias in the first column. To allow filtering to all the columns i do
need the following code to work:

-------------------------------------------------------------------------------------------------------------------------
treemodelfilter .set_modify_fun c(types, func, data=None)
def func(model, iter, column, user_data)
-------------------------------------------------------------------------------------------------------------------------

where types should be:
types = (str, str, str, str, str)

the function to allow filtering:
def visible_cb(self , treestore, column, iter, x)
return treestore.get_v alue(iter, column) in x

and the rest of the code never changes...howev er it is not woking. Any
suggestion about the code mention?? am i making mistakes?? where?? do i have
to pass the column number someway to the visible_cb function??? how??

can any of you suggest a code example to follow and find out how the
treeview must be coded in order to allow "multicolum n filtering"???

thanks in advance for your support..
Juan
Apr 27 '06 #1
2 3092
JUAN ERNESTO FLORES BELTRAN napisa³(a):
can any of you suggest a code example to follow and find out how the
treeview must be coded in order to allow "multicolum n filtering"???

thanks in advance for your support..


Your question was answered on PyGTK mailing list. Please, don't crosspost.

--
Jarek Zgoda
http://jpa.berlios.de/
Apr 27 '06 #2
Your question was answered on PyGTK mailing list. Please, don't crosspost.


Where is the pygtk mailing list?

Apr 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6670
by: Ian Stiles | last post by:
I have tried everything under the sun to get rid of horrible flashing and flickering that occurs on a CSharp form when the form hosts a TreeView or WebBrowser control and then you resize the form. Here is what I've tried so far: 1. Turning off CS_VREDRAW and CS_HREDRAW in both the parent form and a subclass of the control via the "override CreateParams" property (these values were already off). 2. Setting various styles and handling...
2
5397
by: Joe | last post by:
I'm loading a TreeView with ~8900 root nodes and only a couple of child nodes giving a total of 8910 nodes. It takes several seconds for the tree to display. The method that populates the tree returns in < .5 seconds. Populating the tree in the Load event takes even longer than clicking a button after the screen has been loaded. try
7
14811
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
8
12773
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
1
4934
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only nodes 1 to 10, but when the user clicks , the tree will display nodes 11 to 20. Page 1 will is loaded when the page that contains the ascx (parent of the treeview) is loaded. This is all cool. The treeview displays correctly. When I click the ...
0
4030
by: John Smith | last post by:
I have the following problem: An asp.net treeview for which an initial set of nodes is retrieved and subsequently on expand the child nodes are retrieved. For the initial set of nodes asp.net produces a 'javascript:onclick()' in the anchor element of each of these nodes that allows getting the selected node later, the automagic onclick handler 'remembers' the selected node for later use and is generated by asp.net (webresource.asd or...
0
1858
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I am running Access 2007. I have a report that I want to filter. I can go into Advanced...Advanced Filter/Sort... and setup a filter that works fine on the report when I apply it. When in this query creation area, I can right click and Save Query. I have saved a query fine. However, now if I go back later (after closing Access or the report) when I open it it back up (the report), I go back to Advanced...Advanced Filter/Sort.. right click...
0
2222
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I am running Access 2007. I have a report that I want to filter. I can go into Advanced...Advanced Filter/Sort... and setup a filter that works fine on the report when I apply it. When in this filter/query creation area, I can right click and Save Query. I have saved a query fine. However, now when I open the report back up (after closing Access or the report) and go back to Advanced...Advanced Filter/Sort.. right click and 'Load from...
0
1419
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I've created a treeview control that gives a folder browser view of a given computer. The treeview is populated using the following methods: Protected Sub treeDst_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles treeDst.Init Dim dirInfo As New DirectoryInfo("C:\") dstDir.Text = dirInfo.FullName
0
8966
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9257
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6749
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6052
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4567
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.