ListBox - Double click item

3 posts, 0 answers
  1. Ben
    Ben avatar
    10 posts
    Member since:
    Nov 2017

    Posted 13 Aug 2018 Link to this post

    Hello, 

    I'm trying to get the dataTextField & dataValueField from double clicking on the ListBox. 

    I feel like this should be easy but i cant find anything in the documentation or on google. 

     

    So far i have this:

     

  2. Ben
    Ben avatar
    10 posts
    Member since:
    Nov 2017

    Posted 13 Aug 2018 Link to this post

    yeah so the forum decided to post my message without me finishing it?

     

    So far i have:

       listBox.wrapper.find(".k-list").on("dblclick", ".k-item", function(e) {



        });

  3. Preslav
    Admin
    Preslav avatar
    591 posts

    Posted 14 Aug 2018 Link to this post

    Hello Ben,

    To achieve the desired result, in the dblclick event handler, get the ListBox widget, and use the e.target to get the dataItem.
    For example:

    $("#optional").data("kendoListBox").wrapper.find(".k-list").on("dblclick", ".k-item", function(e) {
    var listBox = $(e.target).closest(".k-listbox").find("[data-role='listbox']").data("kendoListBox");
         var dataItem = listBox.dataItem(e.target);
       
      //...
    });

    For a runnable example, check this Dojo:
    I hope this helps.


    Regards,
    Preslav
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top