PDA

View Full Version : Render complex widget in rows of a list or nestedList



federico.monaldi@gmail.com
1 Dec 2010, 1:25 AM
hi all

i have little experience with sencha touch, but looking around the library i coudn't find any standard way of create a list or NestedList that have some more widgets for each rows.

In the end i came out with the following solution that seems to work (tested in 1.0).
I extended the XTemplate with the ability to supply a function that is invoked for each item in the list and that returns a ext widget that is rendered in the item row.

this is a sample usage:



new Ext.Panel({
layout: {
type: 'vbox',
align: 'center',
pack: 'center'
},
items: [{
width: '90%',
height: '90%',
xtype: 'list',
store: ceckListSignInStore,
itemTpl: new it.eng.iride.touch.widgets.WTemplate(
'<div class="contact"><strong>{title}</strong></div>',
{
createItemComponent: function(item) {
return new Ext.Panel({ html: 'item component' });
}
})
}]
});



I attach here the code, i hope that some sencha user or developer with more experience see this and could tell me if this is a correct approach or there are better way to achieve this.

thanks.
Federico