Why my kendo ui autocomplete only works at the first time after refresh browser?

3 posts, 0 answers
  1. Jingyu
    Jingyu avatar
    1 posts
    Member since:
    Nov 2014

    Posted 18 Dec 2014 Link to this post


    Would you please help me to find what reason cause my code only works at the first time after refresh browser?

    Thank you very much!

    The following is my code:-----------------------------------------------
    <div >
        <input id="txtName"  data-role="autocomplete"    data-filter="startswith"   data-min-length="1" data-placeholder="Select a Name"  data-text-field="FullName"
               data-bind="value:inputsearchName, source: searchedName, enabled: isEnabled, events: { select: selectPerson, change: onChange}" />
        Name :<span data-bind="text: selectedPerson.LogonName"></span>
        var viewModel = kendo.observable({
            searchedName: new kendo.data.DataSource({
                transport: {
                    read: {
                        cache: false,
                        url: "@Url.Action("GetNames")",
                        dataType: "json",
                        contentType: "application/json; charset=utf-8",
                        type: "Get",
                    , parameterMap: function (options, operation) {
                        if (operation === "read") {
                            return {
                                startsWith: $("#txtName").data("kendoAutoComplete").value()
            selectedPerson: {},
            suggest: true,
            selectPerson: function (e) {
                var item = e.sender.dataItem(e.item.index());
                viewModel.set("selectedPerson", item);
        kendo.bind($(document.body), viewModel);
    C#-MVC Controller Code:----------------
    public JsonResult GetNames(string startsWith)
                List<AutoCompletionGroup> employeeList;
                employeeList = Employee.GetEmployeesByCriteria(startsWith);
                return Json(employeeList, JsonRequestBehavior.AllowGet);

  2. Alexander Valchev
    Alexander Valchev avatar
    2887 posts

    Posted 22 Dec 2014 Link to this post

    Hi Jingyu,

    I am afraid that the provided information is not sufficient enough in order to determine what exactly goes wrong.
    Could you please provide a small but runnable test page which isolates the issue? Could you please specify what exactly you mean by "does not work" - do you have problems with the rendering, styling, binding or maybe anything else is not working?

    Looking forward to your reply.

    Alexander Valchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Dave
    Dave avatar
    17 posts
    Member since:
    Jan 2009

    Posted 29 Jun 2015 Link to this post

    This tripped me up also and since there is no answer given, my issue was I did not set serverFiltering to true.

        minLength : 3,
        filter : "contains",
        dataValueField : "key",
        dataTextField : "value",
        dataSource : new kendo.data.DataSource({,
    serverFiltering: true,
            transport : {
                read : /* ...... */
            schema : {
                /* object schema */
Back to Top