简体   繁体   中英

Sencha Touch 2 How to get selected itemTpl in a list

In Sencha Touch 2. How do I get the selected itemTpl in a list view?

So far I have this code:

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'
                                });

Yes, I have tried everything I can think of. ;)

Thanks,

You could just use the target element passed in that event handler, you can then just reference the dom property on the element instance to get the generated html from your itemTpl. It's then up to you how you store that for use elsewhere

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM