Results 1 to 2 of 2

Thread: Error "Uncaught RangeError: Maximum call stack size exceeded "

  1. #1
    Sencha User
    Join Date
    Apr 2014
    Posts
    19
    Answers
    2

    Default Error "Uncaught RangeError: Maximum call stack size exceeded "

    Hi,
    I am getting error "Uncaught RangeError: Maximum call stack size exceeded".I am adding child items to parent. Parent is added to store and i am calling store.sync() . When i do store.sync(), i am getting the error. Please help me. I am pasting my code below.
    This is my model
    Code:
    Ext.define('fullhouse.model.accountModel', {
        extend: 'Ext.data.Model',
    
        requires: [
            'Ext.data.Field',
            'Ext.data.association.HasOne',
            'Ext.data.association.HasMany'
        ],
        uses: [
            'fullhouse.model.user',
            'fullhouse.model.addressModel',
            'fullhouse.model.contactModel',
            'fullhouse.model.branchModel',
            'fullhouse.model.sourceModel'
        ],
    
        idProperty: 'uid',
    
        fields: [
            {
                name: 'status',
                type: 'string'
            },
            {
                name: 'uid',
                type: 'string'
            },
            {
                name: 'accountType',
                type: 'string'
            },
            {
                name: 'gender',
                type: 'string'
            },
            {
                name: 'lastName',
                type: 'string'
            },
            {
                name: 'phone',
                type: 'string'
            },
            {
                name: 'email',
                type: 'string'
            },
            {
                name: 'organization',
                type: 'string'
            },
            {
                name: 'accountManager',
                type: 'auto'
            },
            {
                name: 'fax',
                type: 'string'
            },
            {
                name: 'firstName',
                type: 'string'
            },
            {
                name: 'initials',
                type: 'string'
            },
            {
                name: 'memo',
                type: 'string'
            },
            {
                name: 'middleName',
                type: 'string'
            },
            {
                name: 'mobile',
                type: 'string'
            },
            {
                name: 'organization2',
                type: 'string'
            },
            {
                name: 'website',
                type: 'string'
            },
            {
                name: 'branch',
                type: 'auto'
            },
            {
                name: 'source',
                type: 'auto'
            },
            {
                name: 'addresses',
                type: 'auto'
            },
            {
                name: 'contacts',
                type: 'auto'
            }
        ],
    
        hasOne: [
            {
                associationKey: 'accountManager',
                model: 'fullhouse.model.user',
                foreignKey: 'accountManager',
                getterName: 'getAccountMgr',
                setterName: 'setAccountMgr'
            },
            {
                associationKey: 'branch',
                model: 'fullhouse.model.branchModel',
                foreignKey: 'branch',
                getterName: 'getBranch',
                setterName: 'setBranch'
            },
            {
                associationKey: 'source',
                model: 'fullhouse.model.sourceModel',
                foreignKey: 'source',
                getterName: 'getSource',
                setterName: 'setSource'
            }
        ],
    
        hasMany: [
            {
                associationKey: 'addresses',
                model: 'fullhouse.model.addressModel',
                primaryKey: 'uid',
                foreignKey: 'addresses',
                name: 'addresses'
            },
            {
                associationKey: 'contacts',
                model: 'fullhouse.model.contactModel',
                primaryKey: 'uid',
                foreignKey: 'contacts',
                name: 'contacts'
            }
        ]
    });
    This my 'Save' code

    Code:
    var form = button.up('form');
    var values = form.getValues();
    var accountType = form.getForm().findField('accountType').getValue();
    
    var accountStore = this.getAccountStoreStore();
    //Get form values
    var record=  form.getRecord();
    form = form.getForm();
    
    //Set record values
    form.updateRecord(record);
    
    record.data.addresses = null;
    
    var addresses = record.addresses();
    
    var address = form.findField('visitorAddress').getValue();
    var houseNumber = form.findField('visitorHouseNumber').getValue();
    var postalCode = form.findField('visitorPostalCode').getValue();
    var city = form.findField('visitorCity').getValue();
    var country = form.findField('visitorCountry');
    var countryData = country.findRecordByValue(country.getValue());
    if(postalCode !== null && city !== null && countryData !== null)
    {
        var addressModel = this.getAddressModelModel().create({addressType : 'VisitorAddress', address : address, houseNumber : houseNumber, postalCode : postalCode, city : city, country : countryData, status:'Active'});
        //record.data.addresses = [addressModel];
        addresses.add(addressModel);
        if(accountType === "Organization")
        {
            addressModel = null;
            address = form.findField('postalAddress').getValue();
            houseNumber = form.findField('postalHouseNumber').getValue();
            postalCode = form.findField('postalPostalCode').getValue();
            city = form.findField('postalCity').getValue();
            country = form.findField('postalCountry');
            countryData = country.findRecordByValue(country.getValue());
            if(postalCode !== null && city !== null && countryData !== null)
            {
                addressModel = this.getAddressModelModel().create({addressType : 'PostalAddress', address : address, houseNumber : houseNumber, postalCode : postalCode, city : city, country : countryData, status:'Active'});
                //record.data.addresses.push(addressModel);
                addresses.add(addressModel);
            }
        }
        record.data.addresses = addresses;
    }
    
    record.data.contacts = null;
    //Check if the record is new. If the record is new add it to store.
    if(record.phantom)
    {
        accountStore.add(record);
    }
    //Create or update record
    accountStore.sync();

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Nothing jumps out when I look at your code. Is there a stack trace with this error?

Tags for this Thread

Posting Permissions

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