PDA

View Full Version : Question about the data model and nested data...



koblass
27 Nov 2011, 1:33 AM
Hi,

I've nested data and I'm wondering how I could handle it properly with the data model.
I do understand the hasMany option, but what about "hasOne" ?

For instance I've data like this :


{
propertyText: 'test',
propertyInt: 20,
propertyComplex: {
name: 'my name',
value: 'my value
}
}

How do I map the propertyComplex property ?

Same question for the simple arrays (arrays of string, int, etc..)
For instance:


{
propertyText: 'test',
propertyInt: 20,
propertyArray: [
'my value1',
'my value 2'
]
}

Best regards
Daniel

mitchellsimoens
27 Nov 2011, 6:29 AM
Currently there is no hasOn association although Sencha Touch 2 just got it so it will make it over to Ext JS 4

koblass
27 Nov 2011, 8:37 AM
Great ! Any idea when ?

And regarding the simple type list (array of string for instance), how do you map it ?

Thanks
Daniel

mitchellsimoens
27 Nov 2011, 9:29 AM
No date available on this particular item (hasOne).


["one", "two"]

I suspect that is what you are referring to except that is not a valid response currently with ArrayReader. Right now it must be like:


[["one"], ["two"]]

koblass
28 Nov 2011, 12:04 AM
The array ready is not usable in this situation as the array is part of a big set of nested data like in this example :


{
propertyText: 'test',
propertyInt: 20,
propertyArray: [
'my value1',
'my value 2'
]
}

So I don't know how to map 'my value1' and 'my value 2' in a store...

mitchellsimoens
28 Nov 2011, 6:24 AM
Ypu won't map the array items, just the key 'propertyArray'