Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12594 closed defect (invalid)

dijit.Tree with 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:


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)

TreeConstructor.html (2.3 KB) - added by bht 11 years ago.
Testcase HTML

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by bht

Attachment: TreeConstructor.html added

Testcase HTML

comment:1 Changed 11 years ago by bill

Component: DijitData
Owner: set to Jared Jurkiewicz
Priority: highnormal

It's actually failing in the 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 11 years ago by Jared Jurkiewicz

Resolution: invalid
Status: newclosed

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 ( Invalid bug.

comment:3 Changed 11 years ago by Jared Jurkiewicz

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 11 years ago by bht

Resolution: invalid
Status: closedreopened

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 11 years ago by Jared Jurkiewicz

Resolution: invalid
Status: reopenedclosed

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 11 years ago by Jared Jurkiewicz

And by that I mean implement your own model that meets the model API tree expects.

Note: See TracTickets for help on using tickets.