PDA

View Full Version : Extjs 4.2.3 Combobox getInnerTpl Model and HasOne Association



nelzaatari
25 Apr 2015, 1:20 AM
Hi,
im trying to implement an autocomplete functionality with combo

my model looks like this


Ext.define('WSAVL.model.MapQuery', {
extend: 'Ext.data.Model',
fields: [],
hasOne: [
{
name: 'geometry',
model: 'Geometry',
associationKey: 'geometry' // <- this is the same as what is in the JSON response
},
{
name: 'attribute',
model: 'Attribute',
associationKey: 'attribute' // <- this is the same as what is in the JSON response
},

]
});

associated models look like this


Attribute:


Ext.define('WSAVL.model.Attribute', { extend: 'Ext.data.Model', fields: ['OBJECTID', 'Name', 'Type'] }); Geometry


Ext.define('WSAVL.model.Geometry', { extend: 'Ext.data.Model', fields: ['x', 'y'] });

My Data Looks Like this


{ "displayFieldName": "Name", "fieldAliases": { "OBJECTID": "OBJECTID", "Name": "Name", "Type": "Type" }, "geometryType": "esriGeometryPoint", "spatialReference": { "wkid": 32638 }, "fields": [ { "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" }, { "name": "Name", "type": "esriFieldTypeString", "alias": "Name", "length": 100 }, { "name": "Type", "type": "esriFieldTypeString", "alias": "Type", "length": 50 } ], "features": [ { "attributes": { "OBJECTID": 19067162, "Name": "XX-0010", "Type": "House" }, "geometry": { "x": 000000.75, "y": 000000.25 } } ] } my combobox getInnerTpl method looks like this



getInnerTpl: function() { return '<h3><span>{attributes.Name}</h3>' } but it is displaying the empty list
thank you for any help or suggestions

Gary Schlosberg
28 Apr 2015, 1:07 PM
getInnerTpl: function() { return '<h3><span>{attributes.Name}</h3>' }


Probably not the issue, but are you missing a </span>?

Are you getting any messages or errors in console?