我在页面上有两个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
}
}
});
});
};
适合你吗? –