PDA

View Full Version : Editing nested complex data in JsonStore



suaveant
20 Dec 2010, 11:16 AM
I have been trying to figure out the best way to handle multi-record data embedded in data records for a while now. Say you have data something like:


[
{
name: 'Foo',
prefs: [
{ pref_name: 'color', value: 'red' },
{ pref_name: 'size', value: 'large' }
]
}, ....
]


Its easy enough to display that data, and pull it out to use, but what would be the best way to use the nested data in situations that call for a data store while making sure the data gets written back to the overall data store? I tried writing a converter to create a sub-store but that seems not to work at all. I figure I could do something where I manually tied the sub-datastores hooks in such a way that it wrote back to the original, but if the main store were updated another way I'd need another set of hooks going in reverse and making things much more tangled and confused. I was just wondering if there is a more elegant existing solution to the problem?

Animal
20 Dec 2010, 11:30 AM
If you can wait for Ext4, it handles associations like that.

Sencha Touch uses the same data API right now, so you could prototype with that until Ext4 is in beta and you can play with that.

suaveant
20 Dec 2010, 11:47 AM
If you can wait for Ext4, it handles associations like that.

Excellent. Its no show stopper or anything... there are always ways to work around it. It just comes up often enough that I figured I'd check.

Looking forward to Ext4, then! :)