我正在研究一個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