Opened 10 years ago
Closed 10 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 )
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)
Change History (3)
Changed 10 years ago by
Attachment: | ParentTest.html added |
---|
comment:1 Changed 10 years ago by
Component: | Dijit → Data |
---|---|
Description: | modified (diff) |
Owner: | set to Jared Jurkiewicz |
Summary: | dijit.Tree with dojo.data.ItemFileReadStore too much recursion → ItemFileReadStore too much recursion error when item points to parent |
comment:2 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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
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: