简体   繁体   English

Sencha Touch 2如何获取列表中的选定项目

[英]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? 在Sencha Touch 2中。如何在列表视图中获取选定的itemTpl?

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. 您可以只使用在事件处理程序中传递的目标元素,然后可以仅引用元素实例上的dom属性,以从itemTpl获取生成的html。 It's then up to you how you store that for use elsewhere 然后由您决定如何将其存储在其他地方使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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