简体   繁体   English

使用AngularJS在Kendo Autocomplete上添加“找不到数据”消息

[英]Adding “No data found” message on Kendo Autocomplete with AngularJS

I'm new to Kendo UI and I apologize if this is a simple question, but I am working on a site that has search functionality that uses AutoComplete to show possible results. 我是Kendo UI的新手,如果这是一个简单的问题,我深表歉意,但是我正在一个具有使用AutoComplete显示可能结果的搜索功能的网站上工作。 But when there are no matches the list simply goes away, and I need there to be a message that says there are no more matches in place of that list. 但是,当没有匹配项时,列表就消失了,我需要有一条消息说不再有匹配项代替该列表。

I did not write the majority of this code, but all I can find associated with it is this in HTML: 我没有编写大部分的代码,但是我发现所有与之相关的就是HTML中的代码:

input kendo-auto-complete style="width:100%" ng-model="vm.search" k- k-data-source="vm.searchList" /> 输入kendo-auto-complete style =“ width:100%” ng-model =“ vm.search” k- k-data-source =“ vm.searchList” />

I've checked the Kendo site and there seem to be options to help with my issue, but I don't know how to implement them with AngularJS involved. 我已经检查了Kendo网站,似乎有一些选项可以帮助解决我的问题,但是我不知道如何在涉及到的AngularJS中实现它们。

Basically all options you can find on the KendoUI docs can be converted to be usable with AngularJS. 基本上,您可以在KendoUI文档中找到的所有选项都可以转换为可用于AngularJS。 ( Reference ) 参考

In your case the desired option is called noDataTemplate . 在您的情况下,所需的选项称为noDataTemplate To use this configuration in HTML you have to convert it from camelCase to be dash-seperated and prefix it with k- . 要在HTML中使用此配置,您必须将其从camelCase转换为破折号并以k-前缀。

The result should look like this: k-no-data-template . 结果应如下所示: k-no-data-template

Complete sample in HTML: HTML中的完整示例:

<input kendo-auto-complete k-data-source="data" k-no-data-template="'No Data available!'" />

your can find the solution in this post: 您可以在这篇文章中找到解决方案:

Add new Item with AngularJS 使用AngularJS添加新项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM