-
24 Jun 2011 6:00 AM #1
XTemplate with nested models
XTemplate with nested models
I have a following structure: Shipments (Shipment contains packages, packages contains items).
My models, store an data are in the attachment. (I think they are ok)
When I try to create a template :
as output I get only:Code:store: 'Shipments', itemSelector: '', tpl: new Ext.XTemplate( '<div>', '<tpl for=".">', '<div><h2>Shipment {id}</h2></div>', '<tpl for="packages">', '<div><h3>Package {id}</h3></div>', '<tpl for="items">', '<div>Item {id}</div>', '</tpl>', '</tpl>', '</tpl>', '</div>' )
Shipment 1
Shipment 2
Does anyone know why this doesn't work?
Thanks.
-
24 Jun 2011 7:19 AM #2
I have a similar need (nested model) and struggled for a while but at last I found a post stating that templates only accepts arrays and doesn't suppoets nested stores.
Is your "structure" a plain JS object with array properties or model instance with hasMany relationship?
If former and doesn't work means that nested arrays arent supported.
Otherwise (instance with hasMany relationship) you have to look for altermative (I did) because templates doesn't support them.
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
9 Apr 2013 11:03 AM #3
Can you please elaborate ?


Reply With Quote