How do I get the selected items

Hi there,

I have a Listbox-control like this:


 <ejs-listbox id="bclb" dataSource="@Model.BarcodeOptions" ejs-for="@Model.Market.BarCodeOptions">
                        <e-listbox-selectionsettings showCheckbox="true"></e-listbox-selectionsettings>
                    </ejs-listbox>

how do I get all selected items?

Kind regards,

Martin


1 Reply

GK Gayathri KarunaiAnandam Syncfusion Team January 5, 2021 04:29 PM UTC

Hi Martin, 
Greetings from Syncfusion Support. 
We have checked your reported query and we can get the selected item by using value property in listbox as demonstrated in the below code snippet,

 
Code Example:  
<ejs-listbox id="listbox1" height="330px" dataSource="ViewBag.groupA"> 
    <e-listbox-selectionsettings showCheckbox="true"></e-listbox-selectionsettings> 
</ejs-listbox> 
 
<ejs-button id="primarybtn" content="Primary" isPrimary="true" ></ejs-button> 
<script> 
    document.getElementById("primarybtn").addEventListener('click', function () { 
        elements = ej.base.getInstance(document.getElementById('listbox1'), ejs.dropdowns.ListBox).value; 
    }); 
</script> 
 
We have created a sample based on this issue, please check the below link 
 
Regards, 
Gayathri K 
 
  
  
  
  
  
  


Loader.
Up arrow icon