Results 1 to 2 of 2

Thread: Ext.dataview.DataView prepareAssociatedData does not reset index variable j

    Due to the impact related to this issue, we have to defer this issue to the next major or minor release.
  1. #1
    Sencha User
    Join Date
    Jun 2009
    Vote Rating

    Default Ext.dataview.DataView prepareAssociatedData does not reset index variable j

    The prepareAssociatedData in the dataview prepares the records for rendering the template. If you have more than one association not all referenced records will be converted, because the index variable j used in the inner loop is not reset to zero. You have to add the highlighted statement to preperly iterate over every associated record even if you have more than one association.

            prepareAssociatedData: function(record, ids) {            //we keep track of all of the internalIds of the models that we have loaded so far in here
                ids = ids || [];
                var associations     = record.associations.items,
                    associationCount = associations.length,
                    associationData  = {},
                    i = 0,
                    j = 0,
                    associatedStore, associatedRecords, associatedRecord,
                    associatedRecordCount, association, internalId;
                for (; i < associationCount; i++) {
                    association = associations[i];
                    //this is the hasMany store filled with the associated data
                    associatedStore = record[association.storeName];
                    //we will use this to contain each associated record's data
                    associationData[] = [];
                    //if it's loaded, put it into the association data
                    if (associatedStore && > 0) {
                        associatedRecords =;
                        associatedRecordCount = associatedRecords.length;
                        //now we're finally iterating over the records in the association. We do this recursively
                        // FIX: j = 0
                        for (j = 0; j < associatedRecordCount; j++) {
                            associatedRecord = associatedRecords[j];
                            internalId = associatedRecord.internalId;
                            //when we load the associations for a specific model instance we add it to the set of loaded ids so that
                            //we don't load it twice. If we don't do this, we can fall into endless recursive loading failures.
                            if (ids.indexOf(internalId) == -1) {
                                associationData[][j] =;
                                Ext.apply(associationData[][j], this.prepareAssociatedData(associatedRecord, ids));
                return associationData;

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    I'm going to defer this as the next release looks like there will be changes to the prepareAssociatedData
    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:

Posting Permissions

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