我已经定义了一个sencha列表,如下所示
Ext.List({
itemTpl: '<div class={filterClass}></div>{filterType}',
id: 'sFilter',
width: 200,
cls: 'sFilter',
grouped: false,
indexBar: false,
store: store,
listeners: {
itemtap: function (me, index, item, e) {
var selectedRecord = me.store.getAt(index);
var filterTag = selectedRecord.data.filterTag;
if (filterTag !== searchResultTag.Everything) {
var filteredResults = filterResults(filterTag, allResults);
//some more code
} else {
//some more code
}
}
}
});列表中的项目是动态添加的,它们没有"id“。我想在上面的列表中触发(第一项) itemtap事件。我该怎么做呢?
发布于 2012-04-05 04:49:37
这将允许您抓取所选记录并触发该轻击事件
listeners: {
itemtap: function (me, record, index, item, e) {
var selectedRecord = index.data.filterType;
var rec=record;
if(rec===0){
alert('This is the first record');
}else{
alert('This is not the first record')
}
alert(selectedRecord);
}
}发布于 2012-04-09 14:05:11
listeners: {
itemtap: function (me, index, item,record,e) {
if(index==0){
alert('This is the first record');
}else{
alert('This is not the first record')
}
alert(selectedRecord);
}
}这可能会对你有帮助
https://stackoverflow.com/questions/10010604
复制相似问题