剑道自动完成,关闭事件时关闭下拉菜单

时间:2018-09-13 08:05:14

标签: javascript jquery kendo-ui kendo-asp.net-mvc

我的问题是我想从Kendo自动完成中单击并清空该值,以便再次显示占位符,但下拉菜单保持打开状态。

HTML:

 @(Html.Kendo().AutoComplete()
              .Name("acHeader") //The name of the AutoComplete is mandatory. It specifies the "id" attribute of the widget.
              .DataTextField("Text") //Specify which property of the Product to be used by the AutoComplete.
              .Filter(FilterType.Contains)
              .Placeholder(Model.Code)
              .EnforceMinLength(true)
              .MinLength(1)
              .Events(ev => ev.Select("onNavigateToOtherPage"))
              .Events(ev => ev.Close("emptyAcHeader"))

              .DataSource(source =>
              {
                  source.Custom()
                      .ServerFiltering(true)
                      .Type("aspnetmvc-ajax") //Set this type if you want to use DataSourceRequest and ToDataSourceResult instances.
                      .Transport(transport =>
                      {
                          transport.Read("Action", "Controller");
                      })
                      .Schema(schema =>
                      {
                          schema.Data("Data") //Define the [data](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data) option.
                              .Total("Total"); //Define the [total](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total) option.
                      });
              }))

Javascript / Jquery:

function emptyAcHeader() {

    var AutoComplete = $("#acHeader").data("kendoAutoComplete");
    AutoComplete.value("");
    AutoComplete.bind("close", autocomplete_close); <--- here I get the error
}

也尝试过:

    function emptyAcHeader() {

    var AutoComplete = $("#acHeader").data("kendoAutoComplete");
    AutoComplete.value("");
    AutoComplete.close(); <--- produces deadlock 
calling event again which calls function again and so on
}

0 个答案:

没有答案