Hello,
I have a problem with the multiselect on a webdropdown: I added a script that allows me to select/uselect all items in the dropdown.
function selectedIndexChanged(sender, eventArgs) {
var activeIndex = sender.get_activeItemIndex();
var items = sender.get_items();
if (activeIndex == 0 && items.getItem(0).get_selected() == true) {
for (i = 1; i < items.getLength(); i++) {
var item = items.getItem(i);
item.select();
}
else if (activeIndex == 0 && items.getItem(0).get_selected() == false) {
item.unselect();
else if (activeIndex != 0) {
if (items.getItem(activeIndex).get_selected() == false) {
items.getItem(0).unselect();
My problem is that when I select 'All', the 'All' string appears in the text of the dropdown along with all the other selected elements.
I would like to set the text to "All" without having the full list of elements.
Any idea?
Thank you in advance.
Sandro
Hi,
Just to be sure I understand you right, you want after selecting "All", the text of the WebDropDown to be "All". As now I see it's "All, Active, WithDrawn" ?
Is that correct?
Thanks,
Yes, exactly.
It works perfectly.
Thank you very much.
Ciao
I suggest you the following:
hook to DropDownClosed client event and add the following function:
function dropDownClosed(sender, args) {
if (activeIndex == 0 && items.getItem(0).get_selected() == true)
{
sender.set_currentValue("All", true);
If that helps please verify
Thanks