[wxpython-users] Changing row positions in a wx.Grid

Robin Dunn robin at alldunn.com
Wed May 7 14:09:47 PDT 2008


Mike Driscoll wrote:
> David Anderson wrote:

> 
> As to your original question, I'm not aware of an "easy" way to do it. 
> If I were you, I'd probably loop through looking for whichever rows I 
> want to swap and grab the information from those rows using the grid's 
> methods:
> 
> oneName = myGrid.GetCellValue(row, col)
> oneBirth = myGrid.GetCellValue(row, col)
> ....
> secondName
> 
> (etc...)
> 
> And then use the SetCellValue() method. There's probably a way to do it 
> with SQL too...
> 
> There may be a sorting method I am unaware of too, but that doesn't 
> appear to be what you're looking for anyway.

If the grid is using a custom data table instead of the built in table 
then you can simply change the order of the data in the table (or 
whatever it may be using for the data store) and then ask the grid to 
refresh those rows.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the wxpython-users mailing list