1

Hi folks I'm using dojo tree with ForestStoreModel and ItemFileWriteStore. I'm seeking some out of the box way of adding tree items to the top of the Tree root. The default behaviour is to add items to the bottom of the tree. This is how I add stuffs on to the tree. (Dojo V 1.8)

this.model.newItem({ name:''+item.name+'', type: ''+item.type+''},parent);
Charith De Silva
  • 3,650
  • 4
  • 43
  • 47

1 Answers1

0

answering this for future searchers. I'm quite new for js stuffs so I was mainly relying on DOJO API and documentations attached with them. I've tried to newItem insertion to a specific index using additional parameters as per the API. ie. (args,parent Item, insertIndex, before Item). I've also tried pasteitem method with these parameters (childItem , old parent Item,new parent Item,bcopy, insertIndex, before Item). Neither of them were successful. On the debugger, I tried to step in to these methods and found dojo treat bit differently when you pass root object as your parent object. So i've created a default root level element used that as the root element for my tree. Problem solved. All these functions started working. Unfortunately I couldn't find any documentation that specifies these functions doesn't support Root as the parent parameter. At least for these indexed based insertion purpose. I find it really strange though. I could be still wrong so may be some reader can elaborate on this later. Just putting this forward

Charith De Silva
  • 3,650
  • 4
  • 43
  • 47