PDA

View Full Version : ExtJS Combobox custom template in Shopware



Nowkin
22 Mar 2017, 3:17 AM
Hello

i hope that here somebody can help me. The Shopware backend is using extjs 4.1
Here i want to create a custombox with a custom template. I want that each item in the custombox dropdown has his own font-family.


return me.fontField = Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Schriftart',
store: me.createStore(),
queryMode: 'local',
displayField: 'name',
valueField: 'style',
tpl: Ext.create('Ext.XTemplate',
'<tpl for=".">',
'<div class="x-boundlist-item" style="font-family: Arial;">{name}</div>',
'</tpl>'
&nbsp;),
listeners:{
scope: this,
select: me.onFontChange,
}
});

thats the code i am trying currently to use to show at least the name in the combobox item. normally it should work with {name} but i all the time get an error in shopware like this:


Syntax Error in template &quot;/var/www/shop2/engine/Shopware/Plugins/Community/Backend/TBCounterBannerEmotionElement/Views/emotion_components/backend/emotion-components-counter.js&quot; on line 86 &quot;'&amp;lt;div class=&amp;quot;x-boundlist-item&amp;quot; style=&amp;quot;font-family: Indie Flower;&amp;quot;&amp;gt;{name}&amp;lt;/div&amp;gt;',&quot; unknown tag &quot;name&quot; in engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 657</h3>

i hope somebody can help

kind regards

Gary Schlosberg
22 Mar 2017, 6:26 AM
Are you sure your data has a 'name' field?