我在頁面上有兩個Kendo ui multiselect元素從列表中選擇商店。在選擇事件我有一個函數調用,我檢查所選商店是否在另一個列表中。從Kendo UI Multiselect元素中刪除所選項目
如果選定的項目已被分配到另一個列表我提示確認。當用戶點擊確定,那麼確定,當點擊取消時,我必須從多選元素中刪除選定的項目。
這裏是我的功能:
function checkStoreSelection(e) {
var selectedStore = this.dataSource.view()[e.item.index()];
var selectedStoreId = selectedStore.Id;
$.each(surveysData, function (index, surveyVal) {
// get each store
$.each(surveyVal.Stores, function (storesIndex, storesVal) {
// check if a store already assigned to another survey
if (selectedStoreId == storesVal.DBId) {
var answer = confirm('Some text here ... ');
if (answer) {
// nothing todo here
} else {
// have to remove the selected item
}
}
});
});
};
適合你嗎? –