1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    31
    Vote Rating
    0
    billsalvucci is on a distinguished road

      0  

    Default associations getting set upon store.insert

    associations getting set upon store.insert


    I have a Contact model with a hasOne association to Address

    Code:
    hasOne: [
            {
                instanceName: 'address',
                associationKey: 'address',
                model: 'CrmApp.model.Address',
                getterName: 'getAddress',
                foreignKey: 'addressId',
                setterName: 'setAddress'
            }
    and code that inserts a newly constructed Contact into a store
    Code:
    var a = Ext.create('CrmApp.model.Contact');
    store.insert(0, a);
    when I inspect the variable a after it is created (before the store.insert), the association is not set, i.e. a.address is undefined.

    but if I inspect it after the store.insert call, it is set with data seemingly copied from another model instance from the store (probably the one that was currently selected in the grid?).

    I stepped into Store.insert and the address property is undefined until the line me.fireEvent('add', me, records, index);
    after that executes, it is set.

    As far as I know, I do not have any listeners on that event. Any idea where/why the associations are being set?

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    31
    Vote Rating
    0
    billsalvucci is on a distinguished road

      0  

    Default


    mystery solved. I had a renderer which was calling getAddress. The getter will fetch the address. I changed the renderer to use the instance variable directory. i.e.

    contact.getAddress()

    changed to

    contact.address

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar