We have prepared a sample as per your requirement (“Item selected in first dropdown should not be displayed in the second dropdown”).please check it.
In the above provided sample we have bounded the checkChange event to the first dropdown. The event will trigger when change the checkbox state in the first dropdown list.
// Creating First DropDown list $('#firstDayList').ejDropDownList({ dataSource: DayList, fields: { text: "text", value: "text" }, showCheckbox: true, allowMultiSelection: true, // Trigger when ever the check box state has been changed. checkChange:"onChange" }); |
In that event we have removed the selected item from the data source and reload the modified data source to the second dropdown through set model option as shown below
function onChange() {
var result = firstDrpdwn.model.text.split(","); var array = JSON.parse(JSON.stringify(DayList));
// Find the selected element and removed for (i = 0; i < result.length; i++) findAndRemove(array, 'text', result[i]);
// Load the new DataSource to the second dropdownlist secondDrpdwn.option("dataSource", array) } |