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

AutoComplete select event - e.dataItem property not exists

1 Answer 200 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Chris asked on 20 Feb 2017, 04:05 AM

HI

Fix the document description please, There have no e.dataItem property (undefined) : 

WRONG : 

kendo.ui.AutoComplete > select
http://docs.telerik.com/kendo-ui/api/javascript/ui/autocomplete#events-select
EVENT DATA
e.dataItem Object
The data item instance of the selected item.

WORKS :

C:\Program Files\Telerik\UI for ASP.NET MVC Q2 2016\wrappers\aspnetmvc\Examples\VS2015\Kendo.Mvc.Examples\Areas\razor\Views\autocomplete\events.cshtml
C:\Program Files\Telerik\UI for ASP.NET MVC R1 2017\wrappers\aspnetmvc\Examples\VS2015\Kendo.Mvc.Examples\Views\autocomplete\events.cshtml

    function onSelect(e) {
        if ("kendoConsole" in window) {
            var dataItem = this.dataItem(e.item.index());
            kendoConsole.log("event :: select (" + dataItem + ")");
        }
    }

I don't know why the AutoComplete do not provide the e.dataItem property,
but developers will be confused by the wrong document description.

Best regards

Chris

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 21 Feb 2017, 02:43 PM
Hello Chris,

Indeed, for MVC scenario, you need to extract the DataItem from the widget, regarding the current selected index. However, regarding the jquery Kendo UI, which the referenced documentation article is actually about - the dataItem is accessible trough the arguments of the event.

You can test this in the dojo, in the very same example.

In addition, we will consider adding similar example, demonstrating how to access the DataItem for MVC scenario and documentation.

Regards,
Nencho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
AutoComplete
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Nencho
Telerik team
Share this question
or