#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)
Change History (14)
Changed 11 years ago by
Attachment: | debugger.jpg added |
---|
Changed 11 years ago by
Attachment: | sample.html added |
---|
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
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:4 Changed 11 years ago by
kzyp add support to DataStore? to handle nested items, I think this fixes your problem. Kris, thanks for the quick fix.
comment:5 Changed 11 years ago by
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 11 years ago by
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:9 Changed 11 years ago by
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:11 Changed 11 years ago by
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 11 years ago by
Cc: | cjolif added |
---|
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?.