meyerovb
11 Aug 2010, 6:31 AM
The below code produces a list with 2,1,3,4. Clicking on 3 alerts 4, clicking on 4 alerts 3 (1 & 2 alert correctly).
Ext.setup({ onReady: function () {
var list = new Ext.List({
fullscreen: true,
store: new Ext.data.Store({ fields: ['i'] }),
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{i}</div></tpl>'),
itemSelector: '.list-item',
listeners: {
itemtap: function (list, index, item) {
alert(list.getStore().getAt(index).data.i);
}
}
});
list.getStore().add({ i: 1 }, { i: 2 });
list.getStore().add({ i: 3 }, { i: 4 });
}});
Ext.setup({ onReady: function () {
var list = new Ext.List({
fullscreen: true,
store: new Ext.data.Store({ fields: ['i'] }),
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{i}</div></tpl>'),
itemSelector: '.list-item',
listeners: {
itemtap: function (list, index, item) {
alert(list.getStore().getAt(index).data.i);
}
}
});
list.getStore().add({ i: 1 }, { i: 2 });
list.getStore().add({ i: 3 }, { i: 4 });
}});