Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14401 closed defect (fixed)

dojox.mvc and dojo.data store

Reported by: adros Owned by: Ed Chatelain
Priority: high Milestone: 1.8
Component: DojoX MVC Version: 1.7.0
Keywords: Cc: Kris Zyp, cjolif
Blocked By: Blocking:

Description

If I use dojo.data store (wrapped in dojo.store.DataStore?) with dojox.mvc, creating StatefulModel? ends up in a recursion. Because more complex items of the store contains properties pointing to the store.

Attachments (2)

debugger.jpg (66.0 KB) - added by adros 8 years ago.
sample.html (879 bytes) - added by adros 8 years ago.

Download all attachments as: .zip

Change History (14)

Changed 8 years ago by adros

Attachment: debugger.jpg added

Changed 8 years ago by adros

Attachment: sample.html added

comment:1 Changed 8 years ago by Ed Chatelain

I was able to recreate this problem. It looks like any nested data coming back from the ItemFileWriteStore? is not usable as is. If you change to use a MemoryStore? (dojo/store/Memory) your structure would work. Or if you could flatten your data to avoid the nested "parent" data it would work. I will have to see if we can update the mvc code to better handle nested data from an ItemFileWriteStore?.

comment:2 Changed 8 years ago by adros

I have used ItemFileWriteStore? in the sample to make it more simple and yes, I could use dojo.store.Memory instead. But the same problem comes with dojox.data.JsonRestStore?. I can not use dojo.store.JsonRest? instead, because it does not the same functionality.

comment:3 Changed 8 years ago by Kris Zyp

In [27330]:

Handle nested items, refs #14401 !strict

comment:4 Changed 8 years ago by Ed Chatelain

kzyp add support to DataStore? to handle nested items, I think this fixes your problem. Kris, thanks for the quick fix.

comment:5 Changed 8 years ago by Ed Chatelain

Kris, I would like to have this fix in the 1.7 branch, is that ok with you? If so do you want to do it, or should I find someone else to roll it back for me. Thanks, Ed

comment:6 Changed 8 years ago by Ed Chatelain

It looks like there is still a problem if a nested item is holding an array. For example, with data like this: {

'identifier': 'name', 'label': 'name', 'items': [

{ 'name':'Africa', 'type':'continent',

'children':[{'_reference':'Egypt'}, {'_reference':'Kenya'}, {'_reference':'Sudan'}] },

{ 'name':'Egypt', 'type':'country' }, { 'name':'Kenya', 'type':'country',

'children':[{'_reference':'Nairobi'}, {'_reference':'Mombasa'}] },

{ 'name':'Nairobi', 'type':'city' }, { 'name':'Mombasa', 'type':'city' }, { 'name':'Sudan', 'type':'country'}, { 'name':'Argentina', 'type':'country', 'population':'40 million' }

]

} The output for children of Africa is only showing: children: Object { id: "Egypt" name: "Egypt" type: "country"} Instead of an array with egypt, kenya and sudan.

comment:7 Changed 8 years ago by Kris Zyp

In [27331]:

Handle nested arrays, refs #14401 !strict

comment:8 Changed 8 years ago by Kris Zyp

In [27332]:

Fix typo in handling nested arrays, refs #14401 !strict

comment:9 Changed 8 years ago by bill

Cc: Kris Zyp added
Milestone: 1.8

Kris, can you add a test for this new feature? For years it's been the policy that everything in dojo/ and dijit/ needs tests.

comment:10 Changed 8 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

In [27353]:

Add test for handling nested arrays, fixes #14401 !strict

comment:11 Changed 8 years ago by cjolif

Sorry if I'm missing something obvious here, but the store interface does have a getChildren API to access children elements. How is that expected to articulate with this? Wouldn't a user expect this method to return the children? Note that I don't know any store implementation implementing getChildren even though the documentation describes it.

comment:12 Changed 8 years ago by cjolif

Cc: cjolif added
Note: See TracTickets for help on using tickets.