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

Autocomplete dropdown and suggest not working

4 Answers 230 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
King Wilder
Top achievements
Rank 2
King Wilder asked on 18 Jul 2012, 07:35 PM
I'm using the KendoUI for MVC Autocomplete extension with a Telerik MVC Extensions Grid and the Autocomplete is not displaying the available suggestions in a drop down list, and it's not "suggesting" anything even though I have .Suggest(true).

I have this in the Head section of the _layout.cshtml view...

@{Html.Telerik().StyleSheetRegistrar().StyleSheets(group => group.AddSharedGroup("SharedStyleSheets")).Render();}


<script src="@Url.Content("~/Scripts/2012.2.423/jquery.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/2012.2.423/kendo.web.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/2012.2.423/kendo.aspnetmvc.min.js")" type="text/javascript"></script>

... and this in the Global.asax file for the Shared stylesheets.

SharedWebAssets.StyleSheets(group => group
    .AddGroup("SharedStyleSheets", styles => styles
        .Add("2012.1.419/telerik.common.min.css")
        .Add("2012.1.419/telerik.web20.min.css")
        .Add("2012.2.423/kendo.common.min.css")
        .Add("2012.2.423/kendo.blueopal.min.css")
        .Combined(true)
        .Compress(true)
        ));

Am I missing something?

This is the HTML of the view.

@using (Html.BeginForm(MVC.Ctaf.SelectItems(), FormMethod.Post))
{
    <fieldset>
        <legend>Filter</legend>
        <p class="colx2-left">
            Class Name: @(Html.Kendo().AutoComplete()
                .Name("classname")
                .DataTextField("Class")
                .DataSource(source =>
                {
                    source.Read(read =>
                    {
                        read.Action("_AutocompleteClasses", "Ctaf");
                    }).ServerFiltering(false);
                })
                .Suggest(true)
            )
 
        </p>
        <p class="colx2-left">
            Subclass Name: @Html.TextBox("subclassname")
        </p>
 
        <p style="clear:both;">
            <input type="submit" value="Filter" />
        </p>
    </fieldset>
     
}
<p> </p>
@{Html.Telerik().Grid(Model.CtafList).Name("CtafGrid")
      .Columns(column =>
      {
          column.Bound(c => c.Id)
              .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= Id #>' />")
              .Title("")
              .Width(36)
              .HtmlAttributes(new { style = "text-align:center" });
          column.Bound(c => c.Class);
          column.Bound(c => c.Subclass);
          column.Bound(c => c.Title);
      })
      .DataBinding(dataBinding => dataBinding.Ajax()
    .Select("_CheckBoxesAjax", "Ctaf"))
    .Scrollable()
    .Pageable(pager => pager.PageSize(40))
      .Render();
      }

This is my controller action.

public virtual ActionResult _AutocompleteClasses()
{
      stringresult = _ctafService.Get().Select(c => c.Class).Distinct().ToList();
 
    return Json(result, JsonRequestBehavior.AllowGet);
}

Any ideas?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 23 Jul 2012, 02:06 PM
Hello,

 
I believe that the jQuery is included twice. First time it is included at the begining of the page and then the ScriptRegistrar includes it again (by default). If this is the case, then I will suggest turn off including of the jQuery file by the ScriptRegistrar:

<% Html.Telerik().ScriptRegistrar().jQuery(false) %>
Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
King Wilder
Top achievements
Rank 2
answered on 23 Jul 2012, 04:14 PM
Georgi,

Sorry I forgot to include that code in the original post, but no, I do have .jQuery(false) included in the ScriptRegistrar.

@{Html.Telerik().ScriptRegistrar()
      .jQuery(false)
      .Scripts(group => group
          .AddSharedGroup("SharedScripts")).Render();}

Here's the complete Global.asax file.

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
 
    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);
    RegisterAssets();
}
 
protected void RegisterAssets()
{
    SharedWebAssets.Scripts(group => group
        .AddGroup("SharedScripts", scripts => scripts
            .Add("constellation/js/old-browsers.js")
            .Add("constellation/js/jquery.accessibleList.js")
            .Add("constellation/js/searchField.js")
            .Add("constellation/js/common.js")
            .Add("constellation/js/standard.js")
            .Add("constellation/js/standard.ie.js")
            .Add("constellation/js/jquery.tip.js")
            .Add("constellation/js/jquery.contextMenu.js")
            .Add("constellation/js/jquery.modal.js")
            .Add("constellation/js/list.js")
            .Add("constellation/js/libs/jquery.dataTables.min.js")
            .Add("constellation/js/libs/jquery.datepick/jquery.datepick.min.js")
            .Add("jquery.validate.min.js")
            .Add("jquery.validate.unobtrusive.min.js")
            .Add("json2.min.js")
            .Add("patentengine-functions.js")
        .Compress(true)
        .Combined(true)
        ));
 
    SharedWebAssets.StyleSheets(group => group
        .AddGroup("SharedStyleSheets", styles => styles
            .Add("2012.1.419/telerik.common.min.css")
            .Add("2012.1.419/telerik.web20.min.css")
            .Add("constellation/css/reset.css")
            .Add("constellation/css/common.css")
            .Add("constellation/css/form.css")
            .Add("constellation/css/standard-alt.css")
            .Add("constellation/css/960.gs.css")
            .Add("constellation/css/960.gs.fluid.css")
            .Add("constellation/css/simple-lists.css")
            .Add("constellation/css/block-lists.css")
            .Add("constellation/css/planning.css")
            .Add("constellation/css/table.css")
            .Add("constellation/css/calendars.css")
            .Add("constellation/css/wizard.css")
            .Add("constellation/css/gallery.css")
            .Add("constellation/gps.css")
            .Add("2012.2.423/kendo.common.min.css")
            .Add("2012.2.423/kendo.blueopal.min.css")
            .Combined(true)
            .Compress(true)
            ));
}


Any other thoughts?

Thanks.
0
Georgi Krustev
Telerik team
answered on 24 Jul 2012, 07:39 AM
Hello King,

 
Unfortunately, I am not sure where could be the problem. I will need a runnable test project, which replicates the issue. Thus I will be able to review it locally and advice you further.

Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
King Wilder
Top achievements
Rank 2
answered on 24 Jul 2012, 05:03 PM
Georgi,

I will put together a runnable app as soon as I can.  I probably won't be this week.  I'll let you know if I find out the cause along the way.

Thanks,

King Wilder
Tags
AutoComplete
Asked by
King Wilder
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
King Wilder
Top achievements
Rank 2
Share this question
or