-
8 May 2011 1:22 PM #1
Can a model be both parent and child?
Can a model be both parent and child?
Hi,
I'd like to set up a parent/child relationship between Models in my app. I've no doubt its possible within Sencha Touch, just don't know how to declare it properly. Can anyone shed some light?
Here's an example of the json data structure I'm modeling:
and this is what my Model looks like:Code:title: "Foo", sessions: [ { title: "Bar", }, { title: "Baz", } ]
ThanksCode:Ext.regModel('ScheduleItem', { fields: [ {name: 'title', type: 'string'} ], hasMany: [ {model: 'ScheduleItem', name: 'sessions'} ] });
Similar Threads
-
Parent-Child relation between windows
By vrassouli in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 28 Dec 2009, 1:43 AM -
[CLOSED]TreeStore.add(parent, child, true) not adding child to parent.getChildren()
By Cputerace in forum Ext GWT: Bugs (2.x)Replies: 1Last Post: 29 Jun 2009, 9:20 AM -
Parent-Child with EditGrid
By Thomas Darimont in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 7 Jan 2009, 9:17 AM -
child = new Ext.Panel({ renderTo: parent.body.id }) vs parent.add(child)
By elDub in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 28 Nov 2007, 9:02 AM -
Auto Fit Child inside Parent
By xwisdom in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 18 Nov 2007, 6:40 AM


Reply With Quote