我正在研究一个Sencha Touch应用程序,并有一个联系人列表。当点击一个列表项时,会显示一个显示一些基本功能(如调用,删除和忽略)的ActionSheet。不幸的是,当用户点击和ActionSheet被激发,列表项目仍然覆盖之下选择(见下图):Sencha Touch - 取消选择列表项目?
下面是绑定到itemTap事件功能:
itemTap: function(list, index)
{
// Deselect the selected record:
var currentRecord = list.getStore().getAt(index);
currentRecord.forename = currentRecord.get('forename');
currentRecord.surname = currentRecord.get('surname');
currentRecord.phoneNumber = currentRecord.get('phoneNumber');
currentRecord.shortFullName = currentRecord.forename + ' ' + currentRecord.surname[0];
list.getStore().deselect(index, true);
callButton.setText('Call ' + currentRecord.shortFullName + ' (' + currentRecord.phoneNumber + ')');
unfriendButton.setText('Remove ' + currentRecord.shortFullName + ' as friend');
friendActionSheet.show();
}
不幸的是,list.getStore().deselect(index, true)
返回以下错误:Object [object Object] has no method 'deselect'
什么我可以做错了任何想法,或者我怎么能做到这一点?
谢谢克里斯,假设你和克里斯一样,在Sencha论坛上为我解决这个问题。它确实有效,我给你一些道具来帮助你! – BenM 2011-03-21 10:03:59
@Chris Thanks :) – Rupesh 2013-12-09 10:06:16
我比下面提到的'disableSelection:true'方法更喜欢这个方法(虽然它很好用),因为这会突出显示用户的选择,然后取消选择它,而'disableSelection'从不突出显示选择到首先。 – 2014-01-16 08:34:53