I know that in an onItemTap, I can retrieve the corresponding data record by
itemtap : function(dv, index, item, e){
dv.getStore().getAt(index);
But my list is filtered via a collectData-Method, so the indexes do not correspond with the ids in the data store.
Is there any way to get the data record when tapping the list, regardless of the list indexes?
[Update]
The snippet where the listview is embedded looks like this:
app.views.MyView = Ext.extend(Ext.TabPanel, {
...
items: [
{
title: _('PanelTitel'),
xtype: 'panel',
scroll: 'vertical',
items: [
getListView(0)
]
},
{
title: _('Second PanelTitel'),
xtype: 'panel',
scroll: 'vertical',
items: [
getListView(1)
]
}
]
…
And the getListView-function:
function getListView(tab_index) {
return new Ext.List({
store: new Ext.data.Store(
{
model: "app.models.MyModel",
sorters: 'created_at'
}
),
itemTpl: new Ext.XTemplate(
'<tpl for=".">',
'<div class="my_row">',
' {username}',
'</div>',
'</tpl>'
),
onItemDisclosure: true,
listeners : {
itemtap : function(dv,index,item,e){
var rec = dv.getRecord(item);
}
},
collectData: function(records, startIndex) {
[some sorting...]
},
});
}
In my code, I always use this:
item, if I’m not remembered wrongly, is theExt.Elementof the clickeddiv, so then you should be fine.DataViewdoes providegetRecordfromElement, so you can use it.If I’m not wrong, I saw this from one of their source file when I happened to face your problem in some months ago.
Happy coding!