NSUutlineView + NSTreeController + CoreData + Bindings Duplicate Rows

First, I would like to point out that I used Apple's sample code for the AbstractTree example .

I have bindings working up to the point that they display nodes, and two buttons that are set to add:

and remove:

are working too.

The problem I am having is that I am dragging one of the nodes to the other to make it a child. In the image below, you can see that I did 2a and 2b to drag under 2, which they do, but they are not removed from where I dragged them from. Also, if I delete one of them , both are deleted.

I am using this  data model.

I set the mode TreeController

to Entity with its name Node (as in my model) which defines the key path children

. I also bound its MOM to the application delegate using the model key path of the managed ObjectContext.

I have bound the value Table Column

to TreeController

, its controller key arrangedObjects

and paths to the model key as name

.

I've uploaded the files here if you need them: link

Can anyone help me? I'm a noob when it comes to CoreData!

Thanks a lot, Gareth

+3


source to share


1 answer


Just set your NSTreeControler's fetch predicate to

parent == nil

      



and you can get this result. thanks for the test app :)

enter image description here

+1


source







All Articles