0

我是 Snecha 的新手,所以请接受我的非技术描述。

MyView.js

itemTpl: [
'<div class="pb10 font-90">{associationDiplayText}</div>' +
                '<div style="float:left">' +
                '<div class="bold font-90"><b>{name}</b></div>' +
                '<div class="font-90">{address1}</div>' +
                '<div class="font-90">{address2}</div>' +
                '</div>' +
                '<div style="display:block;" class="fltR" id="displayIcon">' +
                '<a href="#" class="grayBtnCls fltL" style="margin:0 10px"><span id="phoneId" class="phoneIcon"></span></a>' +
                '<a href="#" class="grayBtnCls fltL" style="margin:0"><span id="emailId" class="emailIcon"></span></a>' +
                '<div class="clr"></div>' +
                '</div>' +
                '<div class="clr"></div>' +
                '<div  style="display:none" id="display" class="mt15 mb10">'+

                    '<tpl for="contacts">', 
                        '<div style="float:left">' +
                        '<div class="font-50">{contactTypeText}:</div>' +
                        '<div class="font-50">{name}</div>' +
                        '</div>' +
                        '<div class="fltR" id="innerdisplay">' +
                            '<a href="#" class="grayBtnCls fltL" style="margin:0 10px"><span id="contactphone" class="phoneIcon"></span></a>' +
                            '<a href="#" class="grayBtnCls fltL" style="margin:0"><span id="contactemail" class="emailIcon"></span></a>' +
                            '<input type="hidden" value="{#}" id="hiddenindex" />'+
                            '<div class="clr"></div>' +
                        '</div>'+
                        '<div class="clr"></div>' + 
                    '</tpl>', 

                '</div>'+
                '<div align="center"><a href="#" ><span id="moreLess" class="moreLinkCls">{moreDetail}</a></div>'
    ]

Controller.js 在 onItemTap 我正在做以下

onItemTapListView: function(view, itemIndex, target, record, event, eOptions) {
     if(event.getTarget("#contactphone.phoneIcon")){    
            var contactRecord = record.data.contacts[itemIndex];
     }

问题是,当我单击第一行时,它给出的 itemIndex = 0 这是我所期望的,但是当我从包含大约 10,15 个项目的联系人列表中单击 phoneIcon 时,它也会给出相同的结果。我需要的是获取用户点击的联系人项目的索引。

感谢期待

4

1 回答 1

0

Each instance of the 1st-level record object will be set to a different row no mather what it contains. ST wont ever know on which contact is the user tapping because the entire row is a single unit.

I know the UI would be different, but my recommendation is to go with a Nested List approach.

regards-

于 2013-08-01T22:47:07.230 回答