Get item ID with double-click

8 posts, 0 answers
  1. Hendrik
    Hendrik avatar
    11 posts
    Member since:
    Feb 2015

    Posted 20 Feb 2015 Link to this post

    How could I get the item ID of the list on a double-click event?

    $("#autocomplete").data("kendoAutoComplete").bind("dataBound", function(event) {
      $(this).bind('dblclick', function(event) {
         // how to access the item ID of the item which was clicked?
      });
    });

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 20 Feb 2015 Link to this post

    Hello Hendrik,

    When the list is opened, it is closed on click, so there is no way to bind to the double click event, for the popup. You can bind the dblclick event to the input that will show the value, and get the item through the AutoComplete dataItem method.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Hendrik
    Hendrik avatar
    11 posts
    Member since:
    Feb 2015

    Posted 23 Feb 2015 in reply to Kiril Nikolov Link to this post

    This way I can only see the innerHTML content of the clicked item. There is no ID of the list element in the event object.

    I think you mean something like this?
    Any suggestions?

    var ac = $("#autocomplete").data("kendoAutoComplete");
    var acList = ac.list
    acList.bind("dblclick", "{extraEvent: ac}", function(event) {
         // how to access the item ID of the autocomplete list item which was clicked?
         console.log(event.data.extraEvent);
    });


    bb
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 25 Feb 2015 Link to this post

    Hello Hendrik,

    I have created an example that shows a possible implementation:

    http://dojo.telerik.com/eVAKi

    Here is a screencast showing this in action:

    http://screencast.com/t/7rLSu2o8Iy

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Hendrik
    Hendrik avatar
    11 posts
    Member since:
    Feb 2015

    Posted 02 Mar 2015 in reply to Kiril Nikolov Link to this post

    Unfortunately I can't load the Dojo example.
  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 03 Mar 2015 Link to this post

    Hello Hendrik,

    I have attached the sample as a .zip file.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Hendrik
    Hendrik avatar
    11 posts
    Member since:
    Feb 2015

    Posted 03 Mar 2015 Link to this post

    Thanks for the example, but I meant an item in the suggestion popup list, not a double-click on the input.
    (I'm preventing the default close behaviour of the suggestion popup)
  9. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 05 Mar 2015 Link to this post

    Hello Hendrik,

    As I said this is not supported and currently cannot be achieved. The suggestion is just a workaround that you can decide whether will work for you or not. As for the double click on the popup - You can submit this as a feature request on UserVoice. So it will be considered for a future implementation.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready