在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ Kendo DataSource 概述
準(zhǔn)備
Kendo UI 特效概述
Kendo MVVM 數(shù)據(jù)綁定(三) Click
Kendo MVVM 數(shù)據(jù)綁定(十) Source
Kendo MVVM 數(shù)據(jù)綁定(二) Checked
Kendo MVVM 數(shù)據(jù)綁定(五) Events
UI Widgets 概述
Kendo MVVM 數(shù)據(jù)綁定(一) attr
單頁(yè)面應(yīng)用(二) Router 類
單頁(yè)面應(yīng)用(四) Layout
Kendo DataSource 概述
Kendo MVVM 數(shù)據(jù)綁定(四) Disabled/Enabled
Kendo MVVM 數(shù)據(jù)綁定(十一) Value
Kendo MVVM (二) ObservableObject 對(duì)象
單頁(yè)面應(yīng)用(一)概述
Kendo UI 模板概述
Kendo MVVM 數(shù)據(jù)綁定(七) Invisible/Visible
Kendo MVVM 數(shù)據(jù)綁定(八) Style
初始化 Data 屬性
Kendo UI Validator 概述
單頁(yè)面應(yīng)用(三) View
Kendo MVVM 數(shù)據(jù)綁定(九) Text
Kendo MVVM (一) 概述
移動(dòng)應(yīng)用開(kāi)發(fā)簡(jiǎn)介
Kendo MVVM 數(shù)據(jù)綁定(六) Html
使用 Kendo UI 庫(kù)實(shí)現(xiàn)對(duì)象的繼承

Kendo DataSource 概述

Kendo 的數(shù)據(jù)源支持本地?cái)?shù)據(jù)源( JavaScript 對(duì)象數(shù)組),或者遠(yuǎn)程數(shù)據(jù)源(XML, JSON, JSONP),支持 CRUD 操作(創(chuàng)建,讀取,更新和刪除操作),并支持排序,分頁(yè),過(guò)濾,分組和集合等。

準(zhǔn)備開(kāi)始

下面創(chuàng)建一個(gè)本地?cái)?shù)據(jù)源。


var movies = [ {
      title: "Star Wars: A New Hope",
      year: 1977
   }, {
     title: "Star Wars: The Empire Strikes Back",
     year: 1980
   }, {
     title: "Star Wars: Return of the Jedi",
     year: 1983
   }
];
var localDataSource = new kendo.data.DataSource({data: movies});

創(chuàng)建一個(gè)遠(yuǎn)程數(shù)據(jù)源 (Twitter)


var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            // the remote service url
            url: "http://search.twitter.com/search.json",

            // JSONP is required for cross-domain AJAX
            dataType: "jsonp",

            // additional parameters sent to the remote service
            data: {
                q: "html5"
            }
        }
    },
    // describe the result format
    schema: {
        // the data which the data source will be bound to is in the "results" field
        data: "results"
    }
});

綁定數(shù)據(jù)源到 UI 組件

Kendo UI 組件很多都支持?jǐn)?shù)據(jù)綁定 ,UI 組件綁定的數(shù)據(jù)源可以在配置 UI 組件時(shí)設(shè)置,或是多個(gè) UI 組件共享同一個(gè)數(shù)據(jù)源。

創(chuàng)建UI組件時(shí)設(shè)置 DataSource 屬性


$("#chart").kendoChart({
    title: {
        text: "Employee Sales"
    },
    dataSource: new kendo.data.DataSource({
        data: [
        {
            employee: "Joe Smith",
            sales: 2000
        },
        {
            employee: "Jane Smith",
            sales: 2250
        },
        {
            employee: "Will Roberts",
            sales: 1550
        }]
    }),
    series: [{
        type: "line",
        field: "sales",
        name: "Sales in Units"
    }],
    categoryAxis: {
        field: "employee"
    }
});

http://wiki.jikexueyuan.com/project/kendo-ui-development-tutorial/images/19.jpg" alt="" />

使用共享的遠(yuǎn)程數(shù)據(jù)源


var sharableDataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "data-service.json",
            dataType: "json"
        }
    }
});

// Bind two UI widgets to same DataSource
$("#chart").kendoChart({
    title: {
        text: "Employee Sales"
    },
    dataSource: sharableDataSource,
    series: [{
        field: "sales",
        name: "Sales in Units"
    }],
    categoryAxis: {
        field: "employee"
    }
});

$("#grid").kendoGrid({
    dataSource: sharableDataSource,
        columns: [
        {
            field: "employee",
            title: "Employee"
        },
        {
            field: "sales",
            title: "Sales",
            template: '#= kendo.toString(sales, "N0") #'
    }]
});

這個(gè)例子使用了模板 template ,模板的用法參見(jiàn)后面的文章。