1. #1
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default [4.1 b2] associationKey property is ignored

    [4.1 b2] associationKey property is ignored


    Below is an excerpt of my model and a grid using it, irrelevant code removed.
    Nested data didn't show up in the grid below when using the Interface model.
    After I've changed associationKey to name, which tells the reader where to find the related data and which defaults to name according to the docs, it started to work.

    Code:
    Ext.define("NAC.model.Device", {
        extend:"NAC.data.Model",
        associations:
            [{
                    foreignKey:"id_device",
                    model:"NAC.model.Interface",
                    type:"hasMany",
                    associationKey:"rel_interfaces",
                    primaryKey:"fk_device"
            }],
         ...
    });
    
    Ext.define("NAC.model.Interface", {
        extend:"NAC.data.Model",
        associations:
                [{
                    foreignKey:"fk_device",
                    model:"NAC.model.Device",
                    type:"belongsTo",
                    associationKey:"rel_device",
                    primaryKey:"id_device"
                }],
         ...
    });
    
    Ext.define('NAC.view.interface.Grid', {
        alias: 'widget.interfacegrid',
        extend: 'NAC.view.Grid',
        title: 'Interfaces',
        iconCls:'icon-interface',
        store: 'Interfaces',
        columns: [
           {header:"Device", width:250, xtype:'templatecolumn',
                tpl: '<a href="#Devices/view/{fk_device}"><tpl for="rel_device">{name}</tpl></a>'
            }
        ]
    });

  2. #2
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    Actually it seems both name and associationKey is required to make it work.

Tags for this Thread