This is a migrated thread and some comments may be shown as answers.

Get item ID with double-click

7 Answers 191 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Hendrik
Top achievements
Rank 1
Hendrik asked on 20 Feb 2015, 02:13 PM
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?
  });
});

7 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 20 Feb 2015, 03:22 PM

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!
 
0
Hendrik
Top achievements
Rank 1
answered on 23 Feb 2015, 03:28 PM
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
0
Kiril Nikolov
Telerik team
answered on 25 Feb 2015, 08:55 AM

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!
 
0
Hendrik
Top achievements
Rank 1
answered on 02 Mar 2015, 02:36 PM
Unfortunately I can't load the Dojo example.
0
Kiril Nikolov
Telerik team
answered on 03 Mar 2015, 10:00 AM

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!
 
0
Hendrik
Top achievements
Rank 1
answered on 03 Mar 2015, 10:11 AM
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)
0
Kiril Nikolov
Telerik team
answered on 05 Mar 2015, 07:46 AM

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!
 
Tags
AutoComplete
Asked by
Hendrik
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Hendrik
Top achievements
Rank 1
Share this question
or