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.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

119001 May 3,2015 01:47 PM UTC May 6,2015 03:47 AM UTC JavaScript 3
loading
Tags: ejListBox
Edgar Ricardez Peralta
Asked On May 3, 2015 01:47 PM UTC

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

Sasikala Nagarajan [Syncfusion]
Replied On 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 + "\n" + "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


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

Hi Sasikala

Thank you very much
for your reply

Sasikala Nagarajan [Syncfusion]
Replied On 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


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.

Warning Icon 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.Close Icon

;