FROM : Scott Anguish
DATE : Fri Jan 10 13:35:01 2003
On Friday, January 10, 2003, at 02:23 PM, The Amazing Llama wrote:
> I am stumped. How can I set my tableview to allow me to drag the rows
> around like I can do with the columns via
> - [NSTableView setAllowsColumnReordering:]?
>
> It seems like this should be straightforward, but the only thing I can
> see is to implement some drag-and-drop code that will handle this
> stuff for me.
>
> So, since that's more work than I expect Cocoa to make me do, I'm
> asking the list. Any answers?
>
Nope.. you need to implement drag and drop....
the reordering of columns doesn't actually have any effect on the data
order itself, whereas reordering rows does.
Reordering of multiple rows is something that has been a bit of a head
scratcher for me as far as how best to implement... if you select
multiple disjointed rows, and then drag them to a location... you get
the location where to drop them, and then you need to do all the
reordering (figure out which row item the stuff goes after, keep track
of that instance), then remove them from the data source array and
insert them after the target item..
I guess it's not a terrible head scratcher after all..
this could be done with a subclass of NSTableView that handled all the
details... or even just a helper category that implemented all the drag
and drop stuff for you..
DATE : Fri Jan 10 13:35:01 2003
On Friday, January 10, 2003, at 02:23 PM, The Amazing Llama wrote:
> I am stumped. How can I set my tableview to allow me to drag the rows
> around like I can do with the columns via
> - [NSTableView setAllowsColumnReordering:]?
>
> It seems like this should be straightforward, but the only thing I can
> see is to implement some drag-and-drop code that will handle this
> stuff for me.
>
> So, since that's more work than I expect Cocoa to make me do, I'm
> asking the list. Any answers?
>
Nope.. you need to implement drag and drop....
the reordering of columns doesn't actually have any effect on the data
order itself, whereas reordering rows does.
Reordering of multiple rows is something that has been a bit of a head
scratcher for me as far as how best to implement... if you select
multiple disjointed rows, and then drag them to a location... you get
the location where to drop them, and then you need to do all the
reordering (figure out which row item the stuff goes after, keep track
of that instance), then remove them from the data source array and
insert them after the target item..
I guess it's not a terrible head scratcher after all..
this could be done with a subclass of NSTableView that handled all the
details... or even just a helper category that implemented all the drag
and drop stuff for you..
| Related mails | Author | Date |
|---|---|---|
| The Amazing Llama | Jan 10, 11:24 | |
| Scott Anguish | Jan 10, 13:35 |






Cocoa mail archive

