We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Access multi selected values from dropdownlist and display to screen

Hi,

I am currently using the multi selection dropdownlist. I have populated the list and selected 2 items. I would now like to press a button on my screen and display the items I have selected. (This is my first step towards using the dropdownlist to select multiple items and add them to a table.)

So far, I have managed to display the first selected item on my screen. I would now like to display all the selected items.

My dropdownlist is set up exactly as in the syncfusion documentation here: https://help.syncfusion.com/lightswitch/html-client/dropdownlist/multi-selection-modes
My current button code is this:

myapp.DisplayItems_execute = function (screen)
{
    //Read all the selected items in the drop down list
    var itemsDropdown = screen.findContentItem("ItemListBox");

    //take first selected item and output a property
    var selectedService = servicesDropdown.value.selectedItem;
    screen.TestString = selectedService.Id;
};

Thank you very much in advance,
Anya-May Hope

3 Replies

KV Karthikeyan Viswanathan Syncfusion Team March 9, 2017 10:16 AM UTC

Hi Anya,    
  
Thanks for contacting Syncfusion support.  
  
 Yes, you can get the multiple selected items based on isChecked parameter. Please find to the code example:  
  
<code>  
  
input.ejDropDownList({  
           ……  
  
            change: function (args) {  
                if (servicesDropdown.value.selectedItem == nullservicesDropdown.value.selectedItem = [];  
                (args.isChecked) ? servicesDropdown.value.selectedItem.push(servicesDropdown.value.data[args.itemId]) :servicesDropdown.value.selectedItem.splice(servicesDropdown.value.selectedItem.indexOf(servicesDropdown.value.data[args.itemId]), 1);  
            }  
        });  
  
</code>  
   
   
Regards,  
Karthikeyan V.  



UN Unknown Syncfusion Team March 9, 2017 10:42 AM UTC

Fantastic, just what I needed. Thankyou very much!


GG Gopi Govindasamy Syncfusion Team March 10, 2017 06:00 PM UTC

Hi Anya,  
   
Most Welcome.  
   
Regards,  
Gopi G. 


Loader.
Live Chat Icon For mobile
Up arrow icon