Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1740
Multiple select checkbox with "All" functionality
posted

My WebDropDown is bound to a dataset with multiple select checkbox. I added an extra item to the top of the list "All". Now when the user selects/clicks on the "All" option, all the available options in the WebDropDown should be checked. Can someone please guide or share the code that does this functionality? Thanks

Parents
No Data
Reply
  • 24671
    Suggested Answer
    posted

    Hi,

    Yes sure, 

    so in the selectedIndexChanged event, you will need to do the following:

    1) get the item that's being selected (if that's the first item, the array of selected items will only contain 1 item)

    2) if the item is the first one, i.e. if item.get_index() == 0, then:

    3) add the following code:

    for (i=1; i<sender.get_items().getLength(); i++)

    {

       var item = sender.get_items().getItem(i);

        item.select();

    }

     

    This will select all of your items below the first one. Same for unselecting them, instead of .select(), call unselect().

    Hope it helps,

    Angel 

Children