Saturday, 17 August 2013

Basic CRUD for Marionette Composite View Tree

Basic CRUD for Marionette Composite View Tree

I am using Derick Bailey's jsFiddle
http://jsfiddle.net/derickbailey/xX9X3/ as a starting point. I need to be
able to do things like add, remove, move nodes. I'm currently stuck on the
add code.
I can add a sibling to the tree using this code
addNode: function(event) {
event.stopPropagation()
this.model.collection.add([{nodeName: 'Testing'}])
}
I can add a child but only if there is already one with this code.
this.model.nodes.set([{nodeName: 'Testing'}])
I was trying to create the model node then adding to it but it wasn't
rendering.
addNode: function(){
this.nodes = new MTreeNodeCollection([{nodeName: 'Testing'}]);
}
Any help would be greatly appreciated.

No comments:

Post a Comment