当剑道网格为空时显示一条消息 [英] Display a message within the Kendo grid when it's empty

查看:32
本文介绍了当剑道网格为空时显示一条消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当数据库中没有记录时,我正在尝试在网格内容中显示一条友好消息(例如未找到记录,稍后再试").

I'm trying to display a friendly message (like "No records found, try again later") within the grid content, when there are no records in the database.

从我在 docs 中看到的,目前没有办法这用于网格内容.它仅适用于页脚.您可以在此小提琴中看到示例:http://jsfiddle.net/lav911/uNWXJ/

From what I've seen in the docs, there is currently no way of doing this for the grid content. It's only doable for the footer. You can see the example in this fiddle: http://jsfiddle.net/lav911/uNWXJ/

我故意拼错了数据路径,以便得到一个空的网格.要查看内容,只需注释/取消注释这些行:

I've purposely misspelled the data route, in order to have an empty grid. To see it with content, simply comment / uncomment these lines:

transport: {
            // read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Customers"
            read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Customerss"
        },

是否有一种干净的方法来实现这一目标?

Is there a clean way of achieving this ?

推荐答案

好消息 - 此选项现已可用:

Good news- this option is available now:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/norecords#noRecords

您可以通过剑道模板设置消息:

you can set message via kendo template:

noRecords: {
    template: "No data available on current page. Current page is: #=this.dataSource.page()#"
}

或通过消息选项:

noRecords: true,
messages: {
    noRecords: "There is no data on current page"
}

默认文本是没有可用的记录".当设置 noRecords: true only

default text is "No records available." when set noRecords: true only

这篇关于当剑道网格为空时显示一条消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆