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

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

问题描述

我在数据库中没有记录时,尝试在网格内容中显示友好的讯息(例如未找到记录,稍后再试)。



根据我在文档中看到的内容,目前没有办法对网格内容执行此 。它只能对页脚执行。您可以在此小提琴中看到示例: http://jsfiddle.net/lav911/uNWXJ/



我有意拼写数据路由,为了有一个空网格。要查看内容,只需评论/取消注释以下行:

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

是否有干净的方式实现这一目标?

解决方案

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



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



您可以透过kendo范本设定邮件:

  noRecords:{
template:当前页面上没有可用数据当前页面是:#= this.dataSource.page()#
}
/ pre>

或通过消息选项:

  noRecords:true, 
消息:{
noRecords:当前页面上没有数据
}

默认文本为无可用记录。当设置noRecords:true only


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.

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:

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

you can set message via kendo template:

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

or via message option:

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

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

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

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