Sencha Touch 2 如何在列表中获取选定的 itemTpl

Sencha Touch 2 How to get selected itemTpl in a list

在 Sencha Touch 2 中,如何在列表视图中获取选定的 itemTpl?

到目前为止我有这个代码:

xtype : 'list',
                        store : myStore,
                        id: 'list',
                        itemTpl : "{num}",
                        flex : 1,
                        listeners : {
                            itemsingletap : function(list, idx, target, record, evt) {
                                var item = getItemTpl(); 
                                var tpl = Ext.getCmp('list').getItemTpl();
                                var me = Ext.getCmp('list').selected.getRange();

                                var records = list.getItemTpl();
                                var recordB = record.getRecord(item);                        
                                var selected = record.get('selected');

                                console.log(selected);

                                view.push({
                                    xtype : 'hView'
                                });

是的,能想到的我都试过了。 ;)

谢谢,

您可以只使用在该事件处理程序中传递的目标元素,然后您可以只引用元素实例上的 dom 属性 以从您的 itemTpl 中获取生成的 html .然后由您决定如何存储它以供其他地方使用