View Full Version : Putting an xtype in an itempTpl

18 Aug 2011, 5:57 PM
Hi, I have a shopping cart in a List, and I want each item to have a selectfield in it as opposed to using plain old <select>.

I would like to be able to define an xtype inside the XTemplate, like this:

itemTpl: new Ext.XTemplate(
'<tpl if="id == 0">',

'<tpl if="id &gt; 0">',
'<div class="cart-product-wrap">',
'<img class="orderitem-delete" src="/m/resources/images/delete.png" alt="" />',
'<span class="cart-qty">',
'<label for="cart-qty-{id}">QTY: </label>',
xtype: 'selectfield',
name: 'qty',
id: 'qty',
options: [
{text: '1', value: '1'},
{text: '2', value: '2'}
'<span class="orderitem-text">{text}</span>',
'<span class="orderitem-price">${price}</span>',

Does anyone know how to do this, or another way of achieving my goal?


22 Aug 2011, 11:50 AM
this might lead you in the right direction