All Components

Grid / Binding to Telerik Backend Services

What are the Telerik Backend Services?

Telerik Backend Services are a set of cloud-based services that enable developers to build and manage mobile apps in significantly faster, easier and more scalable way. Telerik Backend Services can significantly speed-up development by providing your app with data storage, user management and server-code execution. Unlike other products, Telerik Backend Services are the integrated cloud-storage provider for all Telerik products.

» What are Telerik Backend Services

» Telerik Backend Services JavaScript SDK

» Integration with Kendo UI

Note: The Telerik Backend Services datasource is not supported on IE8 and below yet, because it relies on cross-origin resource sharing.

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>Binding to Telerik Backend Services</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="box wide"> 
    <h4>What are the Telerik Backend Services?</h4> 
    <p>Telerik Backend Services are a set of cloud-based services that enable developers to build and manage mobile apps in significantly faster, easier and more scalable way. Telerik Backend Services can significantly speed-up development by providing your app with data storage, user management and server-code execution. Unlike other products, Telerik Backend Services are the integrated cloud-storage provider for all Telerik products.</p> 
    <p style="padding-top: 1em;">» <a class="hyperlink" href="http://docs.telerik.com/platform/backend-services/what-are-telerik-backend-services" title="Getting started with Telerik Backend Services">What are Telerik Backend Services</a></p> 
    <p>» <a class="hyperlink" href="http://docs.telerik.com/platform/backend-services/development/javascript-sdk/introduction">Telerik Backend Services JavaScript SDK</a></p> 
    <p>» <a class="hyperlink" href="http://docs.telerik.com/platform/backend-services/development/javascript-sdk/kendoui/kendo-uiintegration" title="Introduction to Kendo UI and Telerik Backend Services JavaScript integration">Integration with Kendo UI</a></p> 
    <p class="demo-hint" style="padding-top: 1em;">Note: The Telerik Backend Services datasource is not supported on IE8 and below yet, because it relies on <a class="hyperlink" href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing">cross-origin resource sharing</a>.</p> 
   </div> 
   <!--[if gte IE 9]>--> 
   <div id="grid"></div> 
   <script src="../content/shared/js/everlive.all.js"></script> 
   <script>
                var everlive = new Everlive({
                    apiKey: "3q4sHgIqESXbpvOp",
                    scheme: "http"
                });

                $(document).ready(function() {
                    // initialize Everlive application with application API key
                    var dataSource = new kendo.data.DataSource({
                        type: "everlive",
                        transport: {
                            // binding to the Order type in Everlive
                            typeName: "Order"
                        },
                        schema: {
                            model: {
                                id: "Id",
                                fields: {
                                    // default Everlive fields
                                    CreatedBy:  { type: "string" },
                                    CreatedAt:  { type: "date" },
                                    ModifiedAt: { type: "date" },

                                    // type fields
                                    Freight:    { type: "number" },
                                    OrderDate:  { type: "date" },
                                    ShipName:   { type: "string" },
                                    ShipCity:   { type: "string" }
                                }
                            }
                        },
                        serverPaging: true,
                        pageSize: 20,

                        serverSorting: true,
                        sort: { field: 'OrderDate', dir: 'asc' }
                    });

                    $("#grid").kendoGrid({
                        dataSource: dataSource,
                        height: 430,
                        sortable: true,
                        pageable: true,
                        columns: [
                            {
                                field: "Freight",
                                width: 100
                            }, {
                                field: "OrderDate",
                                title: "Order Date",
                                width: 120,
                                format: "{0:MM/dd/yyyy}"
                            }, {
                                field: "ShipName",
                                title: "Ship Name"
                            }, {
                                field: "ShipCity",
                                title: "Ship City",
                                width: 150
                            }
                        ]
                    });
                });
            </script> 
   <!--<![endif]--> 
  </div>   
 </body>
</html>