@@ -11,24 +11,24 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
11
11
#### Example:
12
12
13
13
``` 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" >
16
16
<kendo-grid options =" mainGridOptions" ></kendo-grid >
17
17
18
18
<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>
20
20
< br / >
21
21
< label> Unit Price < input kendo- numeric- text- box k- ng- model= " dataItem.UnitPrice" / >< / label>
22
22
< br / >
23
23
< label my- directive> Discontinued < input type= " checkbox" ng- model= " dataItem.Discontinued" / >< / label>
24
24
</script >
25
25
26
+ </div >
26
27
</div >
27
- </div >
28
28
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" ])
32
32
.directive (" myDirective" , function () {
33
33
return {
34
34
restrict: " AE" ,
@@ -40,60 +40,61 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
40
40
}
41
41
}
42
42
};
43
- }).controller (" MyCtrl" , function ($scope ) {
43
+ })
44
+ .controller (" MyCtrl" , function ($scope ) {
44
45
$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"
68
63
},
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 )};
81
67
}
82
68
}
83
69
},
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: " " , 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
+ }
96
83
}
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
+ }
97
98
};
98
99
99
100
$scope .productNames = [
@@ -102,7 +103,6 @@ The example below demonstrates how to use AngularJS directives in custom Grid po
102
103
" Aniseed Syrup" ,
103
104
" Chef Anton's Cajun Seasoning"
104
105
];
105
- });
106
-
107
- </script >
106
+ });
107
+ </script >
108
108
```
0 commit comments