Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display a message within the Kendo grid when it's empty

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 ?

like image 855
Zubzob Avatar asked May 05 '14 16:05

Zubzob


People also ask

What is dataItem in kendo grid?

Returns the data item to which the specified table row is bound. The data item is a Kendo UI Model instance. When using the Grid's MVC wrapper, the Grid must be Ajax-bound for the dataItem() method to work.

What is Pageable in kendo grid?

pageable Boolean|Object (default: false)If set to true the grid will display a pager. By default paging is disabled. Can be set to a JavaScript object which represents the pager configuration. Don't forget to set a pageSize, no matter if paging is performed client-side or server-side.


1 Answers

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()#" } 

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

like image 55
MarkosyanArtur Avatar answered Sep 23 '22 20:09

MarkosyanArtur