リストから店舗を選択するために、ページに 2 つの Kendo ui multiselect 要素を取得しました。選択イベントで、選択したストアが別のリストにあるかどうかを確認する関数呼び出しがあります。
選択したアイテムが既に他のリストに割り当てられている場合は、確認を求めます。ユーザーが [OK] をクリックすると、[OK] をクリックします。[キャンセル] をクリックすると、選択した項目を複数選択要素から削除する必要があります。
これが私の機能です:
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
}
}
});
});
};