poll.courses = new Ext.List({
store: poll.stores,
itemTpl: new Ext.XTemplate(
'<tpl for=".">',
'{courseCode}',
'</tpl>'
),
allowDeselect:false,
singleSelect:true,
}
2. add itemtap listener to poll.courses to get user selected item
itemtap: function(view, index, item, e){
console.log("you tap " + view.getStore().getAt(index).get('courseCode'));
}
view.getStore().getAt(index) return the selected item of data model type. here will be poll.stores 's data model, which is defined as:
Ext.regModel('Pollings', {
fields: [
{name: 'courseCode', type:'string'},
]
});
沒有留言:
張貼留言