1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    32
    Vote Rating
    0
    Ayame is on a distinguished road

      0  

    Question Using Nested List with linked Models

    Using Nested List with linked Models


    Hi,

    I'm trying to use a Nested List with a Treestore that gets info from a json feed on the same server. Everything works fine as long as I follow the vimeo example on nested lists, however that method of working has certain limitations imho.

    I wanted to be able to address different fields for my list and detail items, so I thought I would solve it by creating two models instead of a single one and linking them with a hasMany association.
    Unfortunately whatever I attempt, I cannot get it to work with the multiple models. Can someone tell me if this is possible or correct me if I'm doing something wrong?

    The panel:
    Code:
    IMDB.views.CommunityPanel = Ext.extend(Ext.Panel, {
        title: 'Community',
        cls: 'tab community',
        items: [
            new Ext.NestedList({
                fullscreen: true,
                displayField: 'title', 
                store: IMDB.stores.communitystore, 
                title: 'Community list',
                getDetailCard: function(item,parent){
                    detailCard = new Ext.Panel({
                        scroll: 'vertical',
                        tpl: '<h2>{title} {id} {latitude}</h2>'
                    });
                    detailCard.update(item.attributes.record.data);
                    this.backButton.setText(parent.attributes.record.data.title);
                    return detailCard; 
                }
            })
        ]
    });
    The store:
    Code:
    IMDB.stores.communitystore = new Ext.data.TreeStore({
        model: 'Community',
        proxy: {
            type: 'ajax',
            url: '/json.php/CommunityService.getCommunitiesFullInfo/',
            reader: { 
                type: 'tree',
                root: 'communities'
            }
        }
    });
    The models:
    Code:
    Ext.regModel('Member',{
        fields: [
            {name: 'id', type: 'int'},
            {name: 'community_id', type: 'int'},
            {name: 'title', type: 'string'},
            {name: 'latitude', type: 'double'},
            {name: 'leaf', type: 'boolean'}
    
        ]
    });
    Ext.regModel('Community', {
        fields: [{name: 'id', type: 'int'}, {name: 'title', type: 'string'}],
        hasMany: {model: 'Member', name: 'members'}
    });
    regApp code was left out for simplicity.

    Any help appreciated!

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Posts
    32
    Vote Rating
    0
    Ayame is on a distinguished road

      0  

    Exclamation


    Can anyone (staff perhaps?) please have a look at this? Because if it's not possible, that's a serious flaw in the model part of the mvc architecture...

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    2
    Vote Rating
    0
    themaxx is on a distinguished road

      0  

    Default


    Did you solve this? I'm trying to do this too. I'd appreciate any info you have on this subject.

  4. #4
    Sencha User
    Join Date
    Mar 2008
    Posts
    87
    Vote Rating
    0
    insnet is on a distinguished road

      0  

    Default


    I need help too

  5. #5
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    125
    Vote Rating
    0
    JavascriptParrot is on a distinguished road

      0  

    Default


    I have also this problem, but what I read is that nested list with linked models not supported by Touch 1.x

    Edit: Maybe one off the staff can tell how we can do this?

Similar Threads

  1. Nested Models?
    By Bucs in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 14 Mar 2014, 3:17 PM
  2. Nested List and nested models ?
    By shrell in forum Sencha Touch 1.x: Discussion
    Replies: 6
    Last Post: 14 Dec 2011, 7:11 AM
  3. Ext.DataView with nested Models
    By agruenen in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 28 Feb 2011, 8:07 AM
  4. XTemplate an nested models
    By screw in forum Ext GWT: Help & Discussion (1.x)
    Replies: 4
    Last Post: 13 Aug 2009, 3:53 AM
  5. XTemplate an nested models
    By screw in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 1 Feb 2009, 10:18 AM

Thread Participants: 3

Tags for this Thread