Please help: How to use dijit.Tree, dojango(django-modelstore), django-treebeard together

74 views
Skip to first unread message

Hoang Le Thanh

unread,
Dec 21, 2010, 11:26:44 PM12/21/10
to dojang...@googlegroups.com
Hi all,

I'm begin of Python/Django.
I use Dojo(dojango) for my project.
I want implement dijit.Tree, So i use TreeBeard to create tree structure table in database, use modelstore to read table and covert to json for dijit.Tree

Error is: "dojo.data.ItemFileReadStore: The json data as specified by: [/mptree/] is malformed. Items within the list have identifier: [id]. Value collided: [core.post__2]"

I also download dojango sample at https://github.com/klipstein/dojango-sample. It have the same error.

Please help.
error.png

klipstein

unread,
Dec 22, 2010, 3:29:31 AM12/22/10
to dojango-users
Hi Hoang,

could you please post your returned JSON data. Dojango-Sample works
here with Dojo 1.5.0 but I assume I have different data in my tree.

Regards, Tobias

On Dec 22, 5:26 am, Hoang Le Thanh <lethanhhoan...@gmail.com> wrote:
> Hi all,
>
> I'm begin of Python/Django.
> I use Dojo(dojango) for my project.
> I want implement dijit.Tree, So i use TreeBeard to create tree structure
> table in database, use modelstore to read table and covert to json for
> dijit.Tree
>
> Error is: "dojo.data.ItemFileReadStore: The json data as specified by:
> [/mptree/] is malformed. Items within the list have identifier: [id]. Value
> collided: [core.post__2]"
>
> I also download dojango sample athttps://github.com/klipstein/dojango-sample. It have the same error.
>
> Please help.
>
>  error.png
> 114KViewDownload

Hoang Le Thanh

unread,
Dec 22, 2010, 4:19:00 AM12/22/10
to dojang...@googlegroups.com
Hi,

I run dojotree sample in dojango-sample: https://github.com/klipstein/dojango-sample

The returned JSON data is:

{"items": [{"comment": "comment 1", "id": "core.post__1", "name": "Author 1", "children": [{"comment": "comment 1.1", "id": "core.post__2", "name": "Author 1.1", "children": []}, {"comment": "Comment 1.2", "id": "core.post__3", "name": "Author 1.2", "children": []}]}, {"comment": "comment 1.1", "id": "core.post__2", "name": "Author 1.1", "children": []}], "identifier": "id", "label": "name"}

Error message from firebug:

"dojo.data.ItemFileReadStore:  The json data as specified by: [/mptree/] is malformed.  Items within the list have identifier: [id].  Value collided: [core.post__2]"

By the way, help me how to remove   "children": []  from return JSON data, dijit.tree don't realize where is a leaf or a node.


--
You received this message because you are subscribed to the Google Groups "dojango-users" group.
To post to this group, send email to dojang...@googlegroups.com.
To unsubscribe from this group, send email to dojango-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dojango-users?hl=en.


klipstein

unread,
Dec 22, 2010, 6:06:32 AM12/22/10
to dojango-users
Seems like the id = core.post__2 is given twice. Maybe you shouldn't
have circular references in your tree.

Regards, Tobias

On Dec 22, 10:19 am, Hoang Le Thanh <lethanhhoan...@gmail.com> wrote:
> Hi,
>
> I run dojotree sample in dojango-sample:https://github.com/klipstein/dojango-sample
>
> The returned JSON data is:
>
> {"items": [{"comment": "comment 1", "id": "core.post__1", "name": "Author
> 1", "children": [{"comment": "comment 1.1", "id": "core.post__2", "name":
> "Author 1.1", "children": []}, {"comment": "Comment 1.2", "id":
> "core.post__3", "name": "Author 1.2", "children": []}]}, {"comment":
> "comment 1.1", "id": "core.post__2", "name": "Author 1.1", "children": []}],
> "identifier": "id", "label": "name"}
>
> Error message from firebug:
>
> "dojo.data.ItemFileReadStore:  The json data as specified by: [/mptree/] is
> malformed.  Items within the list have identifier: [id].  Value collided:
> [core.post__2]"
>
> By the way, help me how to remove   "children": []  from return JSON data,
> dijit.tree don't realize where is a leaf or a node.
>
> On Wed, Dec 22, 2010 at 3:29 PM, klipstein
> <tobias.klipst...@googlemail.com>wrote:
> > dojango-user...@googlegroups.com<dojango-users%2Bunsu...@googlegroups.com>
> > .

Hoang Le Thanh

unread,
Dec 22, 2010, 8:57:23 PM12/22/10
to dojang...@googlegroups.com
I don't know why but it's ok if i use Nested Sets tree model instead of Materialized Path tree.

Thanks Tobias

To unsubscribe from this group, send email to dojango-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages