gpt4 book ai didi

javascript - Kendo-Template 设置本地文件

转载 作者:行者123 更新时间:2023-12-03 11:58:30 24 4
gpt4 key购买 nike

我这里有来自 Kendo 模板的代码。该代码在线获取 Product.js 文件,我已经下载了它,但我不知道如何在本地实现它。

代码如下:

  (function() {

var app = window.app = window.app || {};
var crudServiceBaseUrl = "http://demos.kendoui.com/service/Products";

app.products = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl,
dataType: "jsonp"
}
}
});
... //rest of code

Products.js 内容:

callback([{"ProductID":1,"ProductName":"Chai","UnitPrice":18,"UnitsInStock":39,"Discontinued":false},{"ProductID":2,"ProductName":"Chang","UnitPrice":19,"UnitsInStock":17,"Discontinued":false}])

还尝试了来自:http://demos.telerik.com/kendo-ui/mobile-listview/local-virtualization的本地数据虚拟化描述但没有机会谢谢你的帮助

最佳答案

这里我在jsfiddle中为本地数据做了一个演示

    var app = new kendo.mobile.Application(document.body);

//create datasource
var movieDataSource = new kendo.data.DataSource({
data: [{
name: "Jane Doe",
age: "30",
letter: "A"
}, {
name: "John Doe",
age: "33",
letter: "B"
}]
});

//instantiate the list view
function loadListView() {
$("#listView").kendoMobileListView({
dataSource: movieDataSource,
template: $("#listviewTemplate").html(),
filterable: {
field: "age",
operator: "startswith"
}
});
}

http://jsfiddle.net/chanaka1/x09tk3xm/2/

关于javascript - Kendo-Template 设置本地文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25501896/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com