Javascript 如何仅使用剑道ui网格
我正在尝试将页面大小减少到300 KB以下,我只想使用和加载需要的“kendo javascript”文件,除了“kendo.web.min.js” 根据我写的代码如下,但这并没有工作:(请帮助我Javascript 如何仅使用剑道ui网格,javascript,asp.net-mvc-4,kendo-grid,Javascript,Asp.net Mvc 4,Kendo Grid,我正在尝试将页面大小减少到300 KB以下,我只想使用和加载需要的“kendo javascript”文件,除了“kendo.web.min.js” 根据我写的代码如下,但这并没有工作:(请帮助我 <head> <title></title> <link href="Content/kendo/2012.3.1114/kendo.common.min.css" rel="stylesheet" /> <link href="Content/k
<head>
<title></title>
<link href="Content/kendo/2012.3.1114/kendo.common.min.css" rel="stylesheet" />
<link href="Content/kendo/2012.3.1114/kendo.default.min.css" rel="stylesheet" />
<script src="Scripts/jquery.min.js"></script>
<script src="Scripts/kendo/2012.3.1114/kendo.core.js"></script>
<script src="Scripts/kendo/2012.3.1114/kendo.data.js"></script>
<script src="Scripts/kendo/2012.3.1114/kendo.grid.min.js"></script>
<script>
$(document).ready(function () {
var products = [{
ProductID: 1,
ProductName: "Chai",
SupplierID: 1,
CategoryID: 1,
QuantityPerUnit: "10 boxes x 20 bags",
UnitPrice: 18.0000,
UnitsInStock: 39,
UnitsOnOrder: 0,
ReorderLevel: 10,
Discontinued: false,
Category: {
CategoryID: 1,
CategoryName: "Beverages",
Description: "Soft drinks, coffees, teas, beers, and ales"
}
}, {
ProductID: 2,
ProductName: "Chang",
SupplierID: 1,
CategoryID: 1,
QuantityPerUnit: "24 - 12 oz bottles",
UnitPrice: 19.0000,
UnitsInStock: 17,
UnitsOnOrder: 40,
ReorderLevel: 25,
Discontinued: false,
Category: {
CategoryID: 1,
CategoryName: "Beverages",
Description: "Soft drinks, coffees, teas, beers, and ales"
}
}, {
ProductID: 3,
ProductName: "Aniseed Syrup",
SupplierID: 1,
CategoryID: 2,
QuantityPerUnit: "12 - 550 ml bottles",
UnitPrice: 10.0000,
UnitsInStock: 13,
UnitsOnOrder: 70,
ReorderLevel: 25,
Discontinued: false,
Category: {
CategoryID: 2,
CategoryName: "Condiments",
Description: "Sweet and savory sauces, relishes, spreads, and seasonings"
}
}, {
ProductID: 4,
ProductName: "Chef Anton's Cajun Seasoning",
SupplierID: 2,
CategoryID: 2,
QuantityPerUnit: "48 - 6 oz jars",
UnitPrice: 22.0000,
UnitsInStock: 53,
UnitsOnOrder: 0,
ReorderLevel: 0,
Discontinued: false,
Category: {
CategoryID: 2,
CategoryName: "Condiments",
Description: "Sweet and savory sauces, relishes, spreads, and seasonings"
}
}];
$("#grid").kendoGrid({
dataSource: {
data: products,
schema: {
model: {
fields: {
ProductName: { type: "string" },
UnitPrice: { type: "number" },
UnitsInStock: { type: "number" },
Discontinued: { type: "boolean" }
}
}
},
pageSize: 20
},
height: 550,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
columns: [
"ProductName",
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "130px" },
{ field: "Discontinued", width: "130px" }
]
});
});
</script>
$(文档).ready(函数(){
var乘积=[{
产品编号:1,
产品名称:“柴”,
供应商编号:1,
类别:1,
QuantityPerUnit:“10盒20袋”,
单价:18.0000,
单位股票:39,
单位顺序:0,
再订购级别:10,
中止:错误,
类别:{
类别:1,
类别名称:“饮料”,
描述:“软饮料、咖啡、茶、啤酒和啤酒”
}
}, {
产品编号:2,
产品名称:“Chang”,
供应商编号:1,
类别:1,
QuantityPerUnit:“24-12盎司瓶”,
单价:19.0000,
单位股票:17,
单位订单:40,
再订购级别:25,
中止:错误,
类别:{
类别:1,
类别名称:“饮料”,
描述:“软饮料、咖啡、茶、啤酒和啤酒”
}
}, {
产品编号:3,
产品名称:“八角糖浆”,
供应商编号:1,
类别:2,
QuantityPerUnit:“12-550毫升瓶”,
单价:10.0000,
单位股票:13,
单位订单:70,
再订购级别:25,
中止:错误,
类别:{
类别:2,
类别名称:“调味品”,
描述:“香甜可口的酱汁、调味品、酱和调味品”
}
}, {
产品编号:4,
产品名称:“安东厨师卡琼调味品”,
供应商编号:2,
类别:2,
QuantityPerUnit:“48-6盎司罐装”,
单价:22.0000,
单位股票:53,
单位顺序:0,
重新排序级别:0,
中止:错误,
类别:{
类别:2,
类别名称:“调味品”,
描述:“香甜可口的酱汁、调味品、酱和调味品”
}
}];
$(“#网格”).kendoGrid({
数据源:{
数据:产品,
模式:{
型号:{
字段:{
产品名称:{type:“string”},
单价:{type:“number”},
UnitsInStock:{type:“number”},
中断:{type:“boolean”}
}
}
},
页面大小:20
},
身高:550,
可滚动:对,
可排序:是的,
可过滤:正确,
可分页:{
输入:正确,
数字:false
},
栏目:[
“产品名称”,
{字段:“单价”,标题:“单价”,格式:“{0:c}”,宽度:“130px”},
{字段:“单位库存”,标题:“库存单位”,宽度:“130px”},
{字段:“中断”,宽度:“130px”}
]
});
});
非常感谢你的回答:我的问题通过添加kendo.pager.min.js文件的引用解决了你有javascript错误吗?或者你的网格现在被创建了吗?你使用的是什么版本的jquery?我的问题是网格没有创建,我使用的是kendo包中的jquery。你能打开jquery文件并检查版本吗endo ui 2012.3需要jqueryKendo ui 2012.3.1114(2012年第三季度)的特定版本-jQuery 1.8.2
<div id="grid"></div>