3

Firstly I'd like to mention that I've been using the Apple Sample Code for the AbstractTree example.

I have the bindings working up to the point that they are displaying nodes and the two buttons that are set to add: and remove: are working too.

The problem I come across is when I'm dragging one of the nodes into another node to make it a child. You can see in the image below that I made 2a and 2b to drag under 2, which they do, but they don't delete from where I dragged them from. Furthermore if I delete either of them both are deleted.

I am using this data model.

I have set the TreeController mode to Entity with it's name as Node (as in my model), which it's children key path to children. I have also bound it's MOM to the app delegate with a model key path of managed ObjectContext.

I have bound the value of the Table Column to the TreeController, its controller key arrangedObjects and its model key path as name.

I have uploaded the files here if you need them: link

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

Many thanks, Gareth

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
GarethPrice
  • 1,072
  • 2
  • 14
  • 25

1 Answers1

1

Set the fetch predicate of your NSTreeController to

parent == nil

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

enter image description here

koen
  • 5,383
  • 7
  • 50
  • 89
Stephan
  • 4,263
  • 2
  • 24
  • 33
  • @GarethPrice you are welcome .. the answer to this questions may interest you too: http://stackoverflow.com/questions/7039165/ I expect the next thing will be the lost of the arbitrary ordering of your list because CoreData relationships are be default not ordered. – Stephan Aug 21 '13 at 06:38