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.
Unfortunately, activation email could not send to your email. Please try again.

Access multi selected values from dropdownlist and display to screen

Thread ID:

Created:

Updated:

Platform:

Replies:

129262 Mar 8,2017 04:27 AM Mar 10,2017 01:00 PM LightSwitch HTML 3
loading
Tags: DropDownList
Anya May Hope
Asked On March 8, 2017 04:27 AM

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

Karthikeyan Viswanathan [Syncfusion]
Replied On March 9, 2017 05:16 AM

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.  


Anya May Hope
Replied On March 9, 2017 05:42 AM

Fantastic, just what I needed. Thankyou very much!

Gopi Govindasamy [Syncfusion]
Replied On March 10, 2017 01:00 PM

Hi Anya,  
   
Most Welcome.  
   
Regards,  
Gopi G. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;