Opened 8 years ago

Closed 8 years ago

#12598 closed defect (invalid)

ItemFileReadStore too much recursion error when item points to parent

Reported by: bht Owned by: Jared Jurkiewicz
Priority: high Milestone: tbd
Component: Data Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

The tree fails if raw items have parent references.

May be I misunderstand the MVC architecture of the tree.

I am (possibly incorrectly) expecting that the model can work with a model object that is useful in the application context beyond simply containing an ID and a label.

Otherwise I could imagine that the API would be much simpler, just expecting a simplified copy of the application model, perhaps a tree of nodes with only IDs and labels instead of ItemFileReadStore and TreeStoreModel.

In my case, every node model object needs a reference to its parent node which IMHO is a very common thing to do.

Please refer to the attached testcase.

Attachments (1)

ParentTest.html (2.4 KB) - added by bht 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by bht

Attachment: ParentTest.html added

comment:1 Changed 8 years ago by bill

Component: DijitData
Description: modified (diff)
Owner: set to Jared Jurkiewicz
Summary: dijit.Tree with dojo.data.ItemFileReadStore too much recursionItemFileReadStore too much recursion error when item points to parent

Passing ticket to Jared but I think you are misunderstanding. Items need to be simple hashes (often mistakenly referred to as "JSON"). Typically you would implement a parent "pointer" by listing the id of the parent, like:

{id: "SF", parent: "CA"}

comment:2 Changed 8 years ago by Jared Jurkiewicz

Resolution: invalid
Status: newclosed

Your usage is incorrect.

1.) You're using a read-only store, you should not be modifying its contents like you are doing. If you want a modifiable store, use the write store: http://docs.dojocampus.org/dojo/data/api/Write#newitem http://docs.dojocampus.org/dojo/data/ItemFileWriteStore

2.) If you want to point to other items, then you need to use _reference structures, not direct item instances. See docs: http://docs.dojocampus.org/dojo/data/ItemFileReadStore#item-structure-examples

Note: See TracTickets for help on using tickets.