#12594 closed defect (invalid)
dijit.Tree with dojo.data.ItemFileReadStore breaks with root constructed by function
Reported by: | bht | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Data | Version: | 1.6.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The tree works if the root object is created inline. But it breaks if the same root object is created with a function.
Please refer to the attached testcase which includes both options.
Attachments (1)
Change History (7)
Changed 10 years ago by
Attachment: | TreeConstructor.html added |
---|
comment:1 Changed 10 years ago by
Component: | Dijit → Data |
---|---|
Owner: | set to Jared Jurkiewicz |
Priority: | high → normal |
It's actually failing in the dojo.data code, nothing to do with Tree or dijit. The problem is on the {id: "2", name: "1_2", ...} data store "item", which isn't marked as an item.
I'm not sure if your test case is valid or not, assigning a new'd object as an item in the data store, rather than a plain hash. Jared?
comment:2 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
You cannot assign generic JavaScript? items directly into a data store as a new item. You must go through the newItem API. The code provided is not using proper data store APIs (http://docs.dojocampus.org/dojo/data//api/Write#newitem). Invalid bug.
comment:3 Changed 10 years ago by
Basically, if you want an updatable store/tree, you need to use a writable store and use the proper store APIs as referred/noted in previous comment
comment:4 Changed 10 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
I don't want an updatable store/tree. Using it would be incorrect. I need to be able to create generic objects that then can be passed into a model, not be restricted by having to write the dojo JSON format on the server. The server writes its framework independent data format which is not language specific - just data - and the JS client deserializes this with a deserializing constructor. This is fairly basic and standard procedure, more efficient than going through bulky name-value JSON which has to be interpreted by the client.
comment:5 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Passing into the model (ForestStoreModel?) for tree means using a writable store with notification APIs. That's the design of the dojo tree ForestDStoreModel, it uses a datastore and if you want to add to it on the fly, you use a writable data store..
If you don't want to do it that way, then implement your own model.
comment:6 Changed 10 years ago by
And by that I mean implement your own model that meets the model API tree expects.
Testcase HTML