Sorting columns with ObjectListView

504 views
Skip to first unread message

Dani Valverde

unread,
Oct 14, 2010, 7:57:31 AM10/14/10
to wxPython-users
Hello,
I have a problem with sorting columns with ObjectListView. If you run
the test.py file, you will see an ObjectListViewScreen. You will see
that the first column (SpeciesID) displays a number. What I would like
to do is to sort the different species always according to this number.
I try to explain a little bit better. The default grouping is by Region
(column 5). However, if you look to column 1, it isn't ordered within
each group. For example, within the group "Catalunya" the first row
should be ordered 439, 443, 758 and so on, while reordering the other
columns accordingly and keeping the grouping. Note that the 1st column
may have the same value in different groups (for example, 1001 is
present in the groups "Catalunya" and "Negev Desert"). Can anyone help
to solve this issue?
Cheers!

Dani

--
Daniel Valverde Saub�
c/Joan Maragall 37 4 2
17002 Girona
Spain
Tel�fon m�bil: +34651987662
e-mail: dani.v...@gmail.com
http://www.acrocephalus.net
http://natupics.blogspot.com

Si no �s del tot necessari, no imprimeixis aquest missatge. Si ho fas utilitza paper 100% reciclat i blanquejat sense clor. D'aquesta manera ajudar�s a estalviar aigua, energia i recursos forestals. GR�CIES!

Do not print this message unless it is absolutely necessary. If you must print it, please use 100% recycled paper whitened without chlorine. By doing so, you will save water, energy and forest resources. THANK YOU!

test.zip
dani_valverde.vcf

Dominique

unread,
Oct 17, 2010, 1:34:08 PM10/17/10
to wxPython-users


On Oct 14, 1:57 pm, Dani Valverde <dani.valve...@gmail.com> wrote:
For example, within the group "Catalunya" the first row
> should be ordered 439, 443, 758 and so on, while reordering the other
> columns accordingly and keeping the grouping.
> Dani
>

Hi Dani,

Your numbers are well sorted, but as strings since they're strings !
To sort them as integers, just turn your str into an int in your
GetSpeciesQuery() function:
queryprint = SpeciesQueryObject(str(speciesID[i])..... should be
queryprint = SpeciesQueryObject(speciesID[i].....

Hope it helps
Dominique

Dani Valverde

unread,
Oct 19, 2010, 9:46:03 AM10/19/10
to wxpytho...@googlegroups.com
Thank you so much! It solved a part of my problem. When I sort the data
according to the Scientific Name or the English Name columns, it sorts
the groups in alphabetical order. Is there a way to sort them according
to the Species ID column, which will have the same value within each
group? Finally, I would like to sort the rows and groups according to
the Species ID column but hiding it. Is it possible to do it?
dani_valverde.vcf
Reply all
Reply to author
Forward
0 new messages