Re: drag/drop after sort



On Fri, 2004-12-31 at 18:51 +0100, Torsten Schoenfeld wrote:
On Fri, 2004-12-31 at 11:14 -0500, Dan Espen wrote:

The problem I have is after I sort by clicking on a column
header, I can no longer drag/drop rows to rearrange them.

That's by design.  When you click on a column header, you not only sort
the list, but you make it sorted.  That is, newly added rows will be
added pre-sorted, and modified rows will be reordered according to the
sort function.  So, manually reordering a sorted list with d'n'd
wouldn't have any effect, since moved rows would automatically jump back
to their original position -- hence d'n'd reordering is disabled when
sorting is enabled.

I haven't tried this, but if it is impossible to make a sorted model
non-sorted again this could be a workaround:

Add a *hidden* column to the model having the value "1" filled in each
row. Then when you fetch the drag_start signal, sort the model by the
hidden column. That would leave the real work for GTK since you wouldn't
have to re-implement the sorting algorithm and it is probably more
efficient as well. Reimplementing them in Perl would probably cause some
scalability issues.

-Samuel
-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam ad debain dod org  | knipknap ad jabber dod org |
 ------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]