dnd

Dojo 0.9 Tree, Json, DnD .. Sample Code too much to hope for ? :)

Hey everyone,

Okay, apparently, I am a complete moron, and I am 'okay' with that. I am a de-constructive learner, I learn by tearing things apart and re-building ;) I have got most of the other stuff working fine (validation text boxes, date selectors, etc) under dojo+django. However, the clincher is that the Tree code in 0.9 is .. strange. I grasp the concept of a data store but, when I point it to a JSON url, nothing happens. No node's displayed, updated, etc.

in my html body I have ;

<div dojoType="dojo.data.ItemFileReadStore" jsId="popStore" url="/data/tstjson/"></div>
<div dojoType="dijit.Tree" id="mytree" store="popStore" labelAttr="name"></div>

and I get the following back from the url /data/tstjson/

[{'id': "1", 'text': "Public", 'leaf': "false", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder","children":[{'id': "1", 'text': "fred hoskins", 'leaf': "true", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder"}]},{'id': "2", 'text': "Private", 'leaf': "false", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder","children":[{'id': "1", 'text': "fred hoskins", 'leaf': "true", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder"}]},{'id': "3", 'text': "Work", 'leaf': "false", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder","children":[{'id': "1", 'text': "fred hoskins", 'leaf': "true", 'qtip': "blah", 'qtipTitle': "foo", 'cls': "folder"}]}]

obviously, you get the idea. 3 categories (okay, with the same person, I know, but, you get the idea hopefully). I have tried with a different id in the children (eg; 11, 22, 33, etc) without any luck either. The dojo environment is all loaded up (I am using the other dojo stuff without trouble).

 

I also get the feeling reading around that I am not the only one who is having problems, so, does anyone have a -nice- -simple- example of programatically loading a tree using JSON ?

As I said, if I am missing something obvious, feel free to smack me upside the head.

Thanx,

Fraunhoffer

tree drop without moving from list

Hi all, first post here, I hope it's descriptive enough.

I'm very new to dojo and am using two trees on a screen.  I want to be able to drag an element from one tree on top of an element

on the other tree.  This maps these two elements together, which is recorded in a database.  The problem I'm having is that dojo assumes I want the first element to be moved to the second tree.

How do I get dojo to send the info on the element dragged and the element dropped onto to my server (rails) but not remove the element from the tree?

I'm creating the trees dynamically from the database by adding new <div> tags, and it all works fine.  Can I override inbuilt functions when I'm building the trees this way?

Thank you

Syndicate content

Back to top