AutoComplete select event - e.dataItem property not exists

2 posts, 0 answers
  1. Chris
    Chris avatar
    64 posts
    Member since:
    Oct 2015

    Posted 19 Feb 2017 Link to this post

    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

  2. Nencho
    Admin
    Nencho avatar
    1682 posts

    Posted 21 Feb 2017 Link to this post

    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.
Back to Top