自动完成 Kendo 控件我不想在没有匹配记录时显示 "No Data found"

Autocomplete Kendo Control I don't want to show "No Data found" when no matching records

我有一个与 Angular 一起使用的自动完成 kendo 控件,它按预期工作,但我不想在没有记录匹配时显示 "NO DATA FOUND" 列表用户输入的文本。

我找到选项 k-no-data-template 但这设置了模板以防找不到数据。

基本上我只想在有匹配结果时显示列表。

你可以试试这个:

noDataTemplate: ''

例如

$("#autocomplete").kendoAutoComplete({
   dataSource: [
     { id: 1, city: "Bangalore" },
     { id: 2, city: "Pune" }
  ],
  dataTextField: "city",
  noDataTemplate: ''
});

因此,未找到数据 消息不会出现,即使您想自定义它,也可以:

noDataTemplate: 'customized message'  // if you want to show your custom message to user

希望它对你有用。

您可以设置选项 k-no-data-template="''"

您可以通过 css/sass 进行全局设置:

.k-nodata
  *
    display: none
  &:after
    content: 'your custom text'