http://dojo.telerik.com/eZEQe/2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Kendo UI Snippet</title>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css"/>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.rtl.min.css"/>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.silver.min.css"/>
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.118/styles/kendo.mobile.all.min.css"/>
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2017.1.118/js/angular.min.js"></script>
<script src="http://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example" ng-app="KendoDemos">
<div ng-controller="MyCtrl">
<kendo-grid options="mainGridOptions"></kendo-grid>
<script type="text/x-kendo-template" id="template">
<label>Product Name <input k-on-change="dataItem.dirty=true" kendo-dropdownlist k-data-source="productNames" data-bind="value: ProductName" /><label>
<br />
<label>Unit Price <input k-on-change="dataItem.dirty=true" kendo-numeric-text-box data-bind="value: UnitPrice" /></label>
<br />
<label my-directive>Discontinued <input type="checkbox" ng-change="dataItem.dirty=true" ng-model="dataItem.Discontinued" /></label>
</script>
</div>
</div>
<script>
var crudServiceBaseUrl = "http://demos.telerik.com/kendo-ui/service";
angular.module("KendoDemos", [ "kendo.directives" ])
.directive("myDirective", function() {
return {
restrict: "AE",
link: function(scope, element) {
if (scope.dataItem.Discontinued) {
element.css("background-color", "red");
} else {
element.css("background-color", "green");
}
}
};
})
.controller("MyCtrl", function($scope) {
$scope.mainGridOptions = {
dataSource: {
transport: {
read: {
url: crudServiceBaseUrl + "/Products",
dataType: "jsonp"
},
update: {
url: crudServiceBaseUrl + "/Products/Update",
dataType: "jsonp"
},
destroy: {
url: crudServiceBaseUrl + "/Products/Destroy",
dataType: "jsonp"
},
create: {
url: crudServiceBaseUrl + "/Products/Create",
dataType: "jsonp"
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return {models: kendo.stringify(options.models)};
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "ProductID",
fields: {
ProductID: { editable: false, nullable: true },
ProductName: { validation: { required: true } },
UnitPrice: { type: "number", validation: { required: true, min: 1} },
Discontinued: { type: "boolean" },
UnitsInStock: { type: "number", validation: { min: 0, required: true } }
}
}
}
},
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
{ field: "ProductName", title: "Product Name" },
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "120px" },
{ field: "UnitsInStock", title:"Units In Stock", width: "120px" },
{ field: "Discontinued", width: "120px" },
{ command: ["edit", "destroy"], title: " ", width: "200px" }],
editable: {
mode: "popup",
template: kendo.template($("#template").html())
},
edit: function(e) {
$('<a class="k-button k-button-icontext k-grid-delete mycustom"><span class="k-icon k-i-delete"></span>Delete</a>').insertAfter(".k-grid-update");
$(".mycustom").click(function ( e) {
e.preventDefault();
console.log('test');
//var elem = $(table).find("tr[data-uid='" + uid + "']");
//grid.removeRow(elem);
alert('test');
});
if (!e.model.isNew()) {
// Disable the editor of the "id" column when editing data items
//var numeric = e.container.find("input[name=id]").data("kendoNumericTextBox");
//numeric.enable(false);
}
}
};
$scope.productNames = [
"Chai",
"Chang",
"Aniseed Syrup",
"Chef Anton's Cajun Seasoning"
];
});
</script>
</body>
</html>
相关推荐
应用kendoui grid实现的多级分组表格展现,里面包含了表格的分组统计以及单表合计功能、还有针对表格的刷新以及子表格刷新功能。此功能是在原有demo版本上改进,增加了很多的个别需求实现,在原来的版本是做不到的。...
该代码类里面实现的主要操作: 1.ajax 访问后代接口,并将结果返回值绑定到kendo ui 的grid上。 2. 实现复杂的kendo ui 的grid的表头设置,这个是本人亲自写的,并且经过验证是正确的
griddatepickercustomfiltering,动态设置显示kendoui grid控件某一列的格式
Kendo UI框架提供了强大的Excel导出功能,通过Grid的saveAsExcel能方便地导出Grid中的数据,而且格式美观大方,使用起来也非常方便。但是在实际使用中不是很理想,主要有以下两个问题: 1. 导出的列数据是原始值 ...
Kendo UI ,在ASP.NET MVC 4中使用Kendo UI Grid
Kendo UI Grid为开发者提供了100多种丰富的网格功能,从基本的筛选、排序,到高级的编页、分层数据分组等等。毫不夸张的说,Kendo UI Grid是同类产品中数一数二的佼佼者。耳听为虚眼见为实,下面我为大家整理了它的...
Kendo UI是一个强大的框架用于快速HTML5 UI开发。基于最新的HTML5、CSS3和JavaScript标准。今天小编通过分享本文给大家介绍Kendo Grid editing 自定义验证报错提示的解决方法
标准kendo ui-grid控件用法,文档形式。
kendoGrid ( { dataSource : dataSource , columns : [ { //column settings field : "type" , title : "Type" , editor : function ( container , options ) { // create custom editors // setup required ...
剑道网格卷轴 kendo-ui 库的程序网格... kendoGrid ( { dataSource : { data : data , pageSize : 20 } , ... //init var kendoGridScroll = new KendoGridScroll . Model ( $ ( "#grid" ) , function ( gri
前台kendo ui js grid 的增删改查,js部分。包括分页查询,服务及异常和激活
Kendo Grid 下载/导出到 CSV 使用客户端过滤和排序时,下载 Kendo UI 网格控件的排序、过滤内容(如果您使用免费版本,则可能会这样做)。依赖项: jQuery - 可能是任何版本,当然是任何足以支持 Kendo Grid 的最新...
KendoUI速查手册--中文
kendoui multiselectingrid,自定义选择显示grid中的td
请注意,Kendo Grid 属于 Kendo UI 的“专业”版本,因此需要适当的许可才能使用。 因此,我不提供受版权保护的脚本/样式以避免违反 Telerik 的许可条款。 但是有 30 天的试用期: Kendo-Scripts 应该进入Scripts...
Ext grid中数据上移下移
kendo_grid_api
kendo ui的中文国际化文件。已经对日期格式化进行了修正。 详细的,请看我的博文,kendo ui那点事里有详细使用说明。
Kendo UI Professional目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四个控件。Kendo UI for jQuery是创建现代Web应用程序的最完整UI库;Kendo UI...