Results 1 to 2 of 2

Thread: Associations are removed when copying model to Tree Store

  1. #1
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    50
    Answers
    2
    Vote Rating
    0
      0  

    Default Answered: Associations are removed when copying model to Tree Store

    I have a model that has an assocation. The association maintains on the Ext.data.store, but once I make a copy of that model and place it into a Ext.tree.store the associations are gone. Is this by design or a bug?

  2. You are running into this: http://www.sencha.com/forum/showthread.php?245005

    Personally I use this override instead of the one in that thread for Sencha Fiddle:

    Code:
    Ext.data.Model.override({
        copy : function() {
            var me     = this,
                copy   = me.callParent(arguments),
                reader = copy.getProxy().getReader();
    
            reader.readAssociated(copy, copy.raw);
    
            return copy;
        }
    });

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,369
    Answers
    3997
    Vote Rating
    1514
      0  

    Default

    You are running into this: http://www.sencha.com/forum/showthread.php?245005

    Personally I use this override instead of the one in that thread for Sencha Fiddle:

    Code:
    Ext.data.Model.override({
        copy : function() {
            var me     = this,
                copy   = me.callParent(arguments),
                reader = copy.getProxy().getReader();
    
            reader.readAssociated(copy, copy.raw);
    
            return copy;
        }
    });
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •