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

ListBox/Grouping: How do I get the value of the id or value property?

Hi Syncfusion team,

I have implemented ejListBox control based on this sample

How do I get the value of the id or value property?

This is my code:

<script type="text/javascript">
   var target;
   var empList = [
               { text: "Erik Linden", eimg: "3", desig: "Representative", country: "England", category: "A" }, { text: "John Linden", eimg: "6", desig: "Representative", country: "Norway", category: "A" },
               { text: "Louis", eimg: "7", desig: "Representative", country: "Australia", category: "B" }, { text: "Lawrence", eimg: "8", desig: "Representative", country: "India", category: "B" }
         ];

   $(function () {
      $('#selectExperts').ejListBox({
         dataSource: empList,height:"240",
         selected: "Onselected",
         fields: { id: "eimg", text: "text", value: "eimg", category: "category" }, allowGrouping:true,enableloadOnDemand:false
      });
   });

   function Onselected(args) {     
      // Here, I need to get the values for id/value properties
   }
</script>


Thanks for your help

3 Replies

SN Sasikala Nagarajan Syncfusion Team May 4, 2015 10:36 AM UTC

Hi Edgar,

Thanks for using Syncfusion products,

We have analyzed your query. We can achieve your requirement using available arguments in selected events. Please refer the below code snippet:

[_script]

function Onselected(args) {

selecteditem_id = args.model.selectedItems[0].attr("id");

selecteditem_value = args.model.selectedItems[0].attr("value");

alert("id of selcted item : " + selecteditem_id + "" + "value of selected item : " + selecteditem_value);
}


Please use above code snippet in your sample to get id, value in “selected” event.

Please let us know if you have further queries,

Regards,
Sasikala Nagarajan



ER Edgar Ricardez Peralta May 4, 2015 02:29 PM UTC

Hi Sasikala

Thank you very much
for your reply


SN Sasikala Nagarajan Syncfusion Team May 6, 2015 03:47 AM UTC

Hi Edgar,
Thanks for the update,
Please let us know, if you need any further assistance. We will be happy to help you out.
Regards,
Sasikala Nagarajan


Loader.
Live Chat Icon For mobile
Up arrow icon