Hi ,
We have web dropdown in our page with checkboxes for multiselection(MultipleSelectionType="Checkbox" ). We have All, Opt 1, Opt 2 , Opt 3 in the list items. We need to disable other options, if we select All. If we unselect All then other options should be enabled. We have implemented the below code.
function selectionChanged(sender, eventArgs) { var activeIndex = sender.get_activeItemIndex(); var items1 = eventArgs.getNewSelection(); var items = sender.get_items(); if (activeIndex == 0 & items.getItem(0).get_selected() == true) { for (var i = 0; i < items.get_length(); i++) { var item = items.getItem(i); if (i != activeIndex) { items.getItem(i).unselect(); items._items[i].set_disabled(true); } } } else { for (var i = 0; i < items.get_length(); i++) { var item = items.getItem(i); if (items.getItem(0).get_selected() == true) { items.getItem(activeIndex).unselect(); } else { for (var i = 0; i < items.get_length(); i++) { if (activeIndex == 0) { if (i != 0) { items._items[i].set_disabled(false); items._items[i].get_element().all[0].disabled = false; } } } } } } }
It is not working in Safari and Chrome browsers. It is only working in IE. Kindly let me know how to fix the issue.
Hello sucheendarnath,
Please do not hesitate to contact me if you are still experiencing any issues with this scenario.
I have tested this scenario using version 13.1 build 2028 and so far the provided code seems to work across all browsers. Attached is my test sample for your reference (the only thing changed is the use of the private _item array with calling the getItem() function.
Please feel free to contact me with any updates or questions.