Skip to content

Commit fac3c1d

Browse files
committed
Update example
1 parent 1919185 commit fac3c1d

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

web/grid/how-to/AngularJS/use-angularjs-popup-edit-template.md

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
1111
#### Example:
1212

1313
```html
14-
<div id="example" ng-app="KendoDemos">
15-
<div ng-controller="MyCtrl">
14+
<div id="example" ng-app="KendoDemos">
15+
<div ng-controller="MyCtrl">
1616
<kendo-grid options="mainGridOptions"></kendo-grid>
1717

1818
<script type="text/x-kendo-template" id="template">
19-
<label>Product Name <input kendo-auto-complete k-data-source="productNames" ng-model="dataItem.ProductName" /><label>
19+
<label>Product Name <input kendo-dropdownlist k-data-source="productNames" ng-model="dataItem.ProductName" /><label>
2020
<br />
2121
<label>Unit Price <input kendo-numeric-text-box k-ng-model="dataItem.UnitPrice" /></label>
2222
<br />
2323
<label my-directive>Discontinued <input type="checkbox" ng-model="dataItem.Discontinued" /></label>
2424
</script>
2525

26+
</div>
2627
</div>
27-
</div>
2828

29-
<script>
30-
var crudServiceBaseUrl = "http://demos.telerik.com/kendo-ui/service";
31-
angular.module("KendoDemos", [ "kendo.directives" ])
29+
<script>
30+
var crudServiceBaseUrl = "http://demos.telerik.com/kendo-ui/service";
31+
angular.module("KendoDemos", [ "kendo.directives" ])
3232
.directive("myDirective", function() {
3333
return {
3434
restrict: "AE",
@@ -40,60 +40,61 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
4040
}
4141
}
4242
};
43-
}).controller("MyCtrl", function ($scope) {
43+
})
44+
.controller("MyCtrl", function($scope) {
4445
$scope.mainGridOptions = {
45-
dataSource: {
46-
transport: {
47-
read: {
48-
url: crudServiceBaseUrl + "/Products",
49-
dataType: "jsonp"
50-
},
51-
update: {
52-
url: crudServiceBaseUrl + "/Products/Update",
53-
dataType: "jsonp"
54-
},
55-
destroy: {
56-
url: crudServiceBaseUrl + "/Products/Destroy",
57-
dataType: "jsonp"
58-
},
59-
create: {
60-
url: crudServiceBaseUrl + "/Products/Create",
61-
dataType: "jsonp"
62-
},
63-
parameterMap: function(options, operation) {
64-
if (operation !== "read" && options.models) {
65-
return {models: kendo.stringify(options.models)};
66-
}
67-
}
46+
dataSource: {
47+
transport: {
48+
read: {
49+
url: crudServiceBaseUrl + "/Products",
50+
dataType: "jsonp"
51+
},
52+
update: {
53+
url: crudServiceBaseUrl + "/Products/Update",
54+
dataType: "jsonp"
55+
},
56+
destroy: {
57+
url: crudServiceBaseUrl + "/Products/Destroy",
58+
dataType: "jsonp"
59+
},
60+
create: {
61+
url: crudServiceBaseUrl + "/Products/Create",
62+
dataType: "jsonp"
6863
},
69-
batch: true,
70-
pageSize: 20,
71-
schema: {
72-
model: {
73-
id: "ProductID",
74-
fields: {
75-
ProductID: { editable: false, nullable: true },
76-
ProductName: { validation: { required: true } },
77-
UnitPrice: { type: "number", validation: { required: true, min: 1} },
78-
Discontinued: { type: "boolean" },
79-
UnitsInStock: { type: "number", validation: { min: 0, required: true } }
80-
}
64+
parameterMap: function(options, operation) {
65+
if (operation !== "read" && options.models) {
66+
return {models: kendo.stringify(options.models)};
8167
}
8268
}
8369
},
84-
pageable: true,
85-
height: 550,
86-
toolbar: ["create"],
87-
columns: [
88-
{ field: "ProductName", title: "Product Name" },
89-
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "120px" },
90-
{ field: "UnitsInStock", title:"Units In Stock", width: "120px" },
91-
{ field: "Discontinued", width: "120px" },
92-
{ command: ["edit", "destroy"], title: "&nbsp;", width: "200px" }],
93-
editable: {
94-
mode: "popup",
95-
template: kendo.template($("#template").html())
70+
batch: true,
71+
pageSize: 20,
72+
schema: {
73+
model: {
74+
id: "ProductID",
75+
fields: {
76+
ProductID: { editable: false, nullable: true },
77+
ProductName: { validation: { required: true } },
78+
UnitPrice: { type: "number", validation: { required: true, min: 1} },
79+
Discontinued: { type: "boolean" },
80+
UnitsInStock: { type: "number", validation: { min: 0, required: true } }
81+
}
82+
}
9683
}
84+
},
85+
pageable: true,
86+
height: 550,
87+
toolbar: ["create"],
88+
columns: [
89+
{ field: "ProductName", title: "Product Name" },
90+
{ field: "UnitPrice", title:"Unit Price", format: "{0:c}", width: "120px" },
91+
{ field: "UnitsInStock", title:"Units In Stock", width: "120px" },
92+
{ field: "Discontinued", width: "120px" },
93+
{ command: ["edit", "destroy"], title: " ", width: "200px" }],
94+
editable: {
95+
mode: "popup",
96+
template: kendo.template($("#template").html())
97+
}
9798
};
9899
99100
$scope.productNames = [
@@ -102,7 +103,6 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
102103
"Aniseed Syrup",
103104
"Chef Anton's Cajun Seasoning"
104105
];
105-
});
106-
107-
</script>
106+
});
107+
</script>
108108
```

0 commit comments

Comments
 (0)