How to get selection of listview in javascript

Hi,

I use a listview and I need to get the selected item from javascipt. I'm not looking for the selected text, I need to get the Id of the item.

How can I do that?

Thank you



3 Replies

KT Karthick T Syncfusion Team April 5, 2018 10:19 AM UTC

Hi Tommy Mailhot,  
 
Thanks for contacting Syncfusion support.  
 
You can use getSelectedItems API to achieve your requirement which will return text, item and data . From that data, you can get ID of the selected list item, using the below code snippet.  
 
listviewInstance.getSelectedItems().data["id"]  
 
We have prepared sample for your reference. Refer to the below sample.  
 
Sample  
 
Please let us know if you need any further assistance on this.  
 
Thanks,  
Karthick T 



TM Tommy Mailhot April 9, 2018 05:33 PM UTC

Work fine!

Thank you


KT Karthick T Syncfusion Team April 10, 2018 04:34 AM UTC

 
We are happy for the provided solution worked at your end. 
 
Thanks, 
Karthick T 


Loader.
Up arrow icon