Last month Telerik released a major update of the Kendo UI. In this article I share some important added features in the Kendo grid. Get recent Kendo UI bundles.

I am using two REST services provided by Telerik:

  • http://worldcup.sfg.io/teams/results
  • http://worldcup.sfg.io/matches/today
The first service end point will consist of some data and the second service end point will consist of empty data.

Figure 1 shows the first REST Service result in POSTMAN.

Figure 1

Figure 2 shows the second REST Service result in POSTMAN.

Figure 2

The following are the added features in the Kendo Grid.

1. NoRecords option

The NoRecords option displays no record message if there is no data in the Kendo grid.

Let's have a demo of it.

Case 1
: using http://worldcup.sfg.io/teams/results.

HTML design
  1. <!DOCTYPE html>
  2. <html
  3. xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <script src="js/jquery.min.js"></script>
  6. <script src="js/jszip.min.js"></script>
  7. <script src="js/kendo.all.min.js"></script>
  8. <script src="js/kendo.web.min.js"></script>
  9. <link href="styles/kendo.metro.min.css" rel="stylesheet" />
  10. link href="styles/kendo.common.min.css" rel="stylesheet" />
  11. <title></title>
  12. </head>
  13. <body>
  14. <h4>Kendo update</h4>
  15. <div id="example">
  16. <div id="grid"></div>
  17. </div>
  18. </body>
  19. </html>
JavaScript
  1. < script >
  2. $(document).ready(function() {
  3. $("#grid").kendoGrid({
  4. dataSource: {
  5. type: "jsonp",
  6. transport: {
  7. read: "http://worldcup.sfg.io/teams/results"
  8. },
  9. pageSize: 20
  10. },
  11. height: 550,
  12. groupable: true,
  13. sortable: true,
  14. pageable: {
  15. refresh: true,
  16. pageSizes: true,
  17. buttonCount: 5
  18. },
  19. columns: [{
  20. field: "country",
  21. title: "Country",
  22. width: 240
  23. }, {
  24. field: "fifa_code",
  25. title: "Fifa Code"
  26. }, ]
  27. });
  28. });
  29. < /script>

Figure 3 shows the result in a browser.


Figure 3


Case 2
: using http://worldcup.sfg.io/matches/today Service

JavaScript

  1. < script >
  2. $(document).ready(function() {
  3. $("#grid").kendoGrid({
  4. dataSource: {
  5. type: "jsonp",
  6. transport: {
  7. read: "http://worldcup.sfg.io/matches/today"
  8. },
  9. pageSize: 20
  10. },
  11. height: 550,
  12. groupable: true,
  13. sortable: true,
  14. pageable: {
  15. refresh: true,
  16. pageSizes: true,
  17. buttonCount: 5
  18. },
  19. columns: [{
  20. field: "country",
  21. title: "Country",
  22. width: 240
  23. }, {
  24. field: "fifa_code",
  25. title: "Fifa Code"
  26. }, ]
  27. });
  28. });
  29. < /script>
Result in Browser

Figure 4

You can see one thing in Figure 4, that is that there is no record to display in the grid, it is the developer's responsibility to show a no record message to the user. Now Kendo gives a new feature called noRecords. It is one of the properties in the Kendo grid to display the no record message.

Case 3: using noRecords property.

JavaScript
  1. < script >
  2. $(document).ready(function() {
  3. $("#grid").kendoGrid({
  4. dataSource: {
  5. type: "jsonp",
  6. transport: {
  7. read: "http://worldcup.sfg.io/matches/today"
  8. },
  9. pageSize: 20
  10. },
  11. height: 550,
  12. groupable: true,
  13. sortable: true,
  14. noRecords: true,
  15. pageable: {
  16. refresh: true,
  17. pageSizes: true,
  18. buttonCount: 5
  19. },
  20. columns: [{
  21. field: "country",
  22. title: "Country",
  23. width: 240
  24. }, {
  25. field: "fifa_code",
  26. title: "Fifa Code"
  27. }, ]
  28. });
  29. });
  30. < /script>

Figure 5 shows the result in a browser.
Figure 5

2. Customizing the noRecord property

We can customize the default message that is displayed in the grid when there is no record using the message property.

Let's have a demo of it.

JavaScript
  1. < script >
  2. $(document).ready(function() {
  3. $("#grid").kendoGrid({
  4. dataSource: {
  5. type: "jsonp",
  6. transport: {
  7. read: "http://worldcup.sfg.io/matches/today"
  8. },
  9. pageSize: 20
  10. },
  11. height: 550,
  12. groupable: true,
  13. sortable: true,
  14. noRecords: true,
  15. messages: {
  16. noRecords: "Sorry , No Record Found!"
  17. },
  18. pageable: {
  19. refresh: true,
  20. pageSizes: true,
  21. buttonCount: 5
  22. },
  23. columns: [{
  24. field: "country",
  25. title: "Country",
  26. width: 240
  27. }, {
  28. field: "fifa_code",
  29. title: "Fifa Code"
  30. }, ]
  31. });
  32. });
  33. < /script>
Figure 6 shows the result in a browser.
Figure 6

3. Adding Templates in the noRecord property

We can more customize the noRecord property using templates.

Let's have a demo of that.

JavaScript
  1. < script >
  2. $(document).ready(function() {
  3. $("#grid").kendoGrid({
  4. dataSource: {
  5. type: "jsonp",
  6. transport: {
  7. read: "http://worldcup.sfg.io/matches/today"
  8. },
  9. pageSize: 20
  10. },
  11. height: 550,
  12. groupable: true,
  13. sortable: true,
  14. noRecords: {
  15. template: "<img src=/no-record-found.jpg> </img>"
  16. },
  17. pageable: {
  18. refresh: true,
  19. pageSizes: true,
  20. buttonCount: 5
  21. },
  22. columns: [{
  23. field: "country",
  24. title: "Country",
  25. width: 240
  26. }, {
  27. field: "fifa_code",
  28. title: "Fifa Code"
  29. }, ]
  30. });
  31. });
  32. < /script>

Figure 6 shows the result in a browser.

Figure 7

The All options in the paging toolbar is one of the added features in Kendo Grid where the user can get all records in a single page.

Figure 8 shows five records in each page.

Figure 8

Figure 9 shows all records in a single page.
Figure 9

I hope you have enjoyed this article.
Thank you.