@@ -114,7 +114,53 @@ The following example demonstrates how to define the item template for the Teler
114
114
</div>
115
115
</script>
116
116
```
117
+ {% if site.core %}
118
+ ``` TagHelper
119
+ <!-- Button for the Create operation. Use it to call the client ListView method add() -->
120
+ <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a>
121
+
122
+ <kendo-listview name="listview">
123
+ </kendo-listview>
124
+
125
+ <script>
126
+ $(function () {
127
+ var listView = $("#listView").data("kendoListView");
117
128
129
+ $(".k-add-button").click(function (e) {
130
+ listView.add();
131
+ e.preventDefault();
132
+ });
133
+ });
134
+ </script>
135
+
136
+ <script type="text/x-kendo-tmpl" id="template">
137
+ <div class="order">
138
+ <h3>#= OrderID #</h3>
139
+ <dl>
140
+ <dt>Ship Name:</dt>
141
+ <dd>#= ShipName #</dd>
142
+ </dl>
143
+ <dl>
144
+ <dt>Ship City:</dt>
145
+ <dd>#= ShipCity #</dd>
146
+ </dl>
147
+ <dl>
148
+ <dt>Freight:</dt>
149
+ <dd>#= kendo.toString(Freight, "n2")#</dd>
150
+ </dl>
151
+ <dl>
152
+ <dt>Order Date:</dt>
153
+ <dd>#= kendo.toString(OrderDate, "D")#</dd>
154
+ </dl>
155
+ <!-- The following markup contains the `Edit` and `Delete` buttons -->
156
+ <div class="edit-buttons">
157
+ <a class="k-button k-edit-button" href="\\#"><span class="k-icon k-i-edit"></span></a>
158
+ <a class="k-button k-delete-button" href="\\#"><span class="k-icon k-i-delete"></span></a>
159
+ </div>
160
+ </div>
161
+ </script>
162
+ ```
163
+ {% endif %}
118
164
## Defining the Editor Template
119
165
120
166
The following example demonstrates how to define the ` EditorTemplate ` for the model:
@@ -160,11 +206,52 @@ The following example demonstrates how to define the `EditorTemplate` for the mo
160
206
}
161
207
</style>
162
208
```
209
+ {% if site.core %}
210
+ ``` TagHelper
211
+ @model ListViewExample.Models.OrderViewModel
212
+ <div class="order">
213
+ <h3 data-bind="text:OrderID"></h3>
214
+ <dl>
215
+ <dt>Ship Name:</dt>
216
+ <dd>
217
+ <input asp-for="@Model.ShipName" type="text" class="k-textbox"/>
218
+ </dd>
219
+ <dt>Ship City:</dt>
220
+ <dd>
221
+ <input asp-for="@Model.ShipCity" type="text" class="k-textbox"/>
222
+ </dd>
223
+ <dt>Freight</dt>
224
+ <dd>
225
+ <kendo-numerictextbox for="@Model.Freight">
226
+ </kendo-numerictextbox>
227
+ </dd>
228
+ <dt>Order Date:</dt>
229
+ <dd>
230
+ <kendo-datapicker for="@Model.OrderDate">
231
+ </kendo-datapicker>
232
+ <span data-for="OrderDate" class="k-invalid-msg"></span>
233
+ </dd>
163
234
235
+ </dl>
236
+ <div class="edit-buttons">
237
+ <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-i-check"></span></a>
238
+ <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-i-cancel"></span></a>
239
+ </div>
240
+ </div>
241
+ <style>
242
+ span.k-tooltip {
243
+ position:absolute;
244
+ margin:6px;
245
+ }
246
+ </style>
247
+ ```
248
+ {% endif %}
164
249
## Enabling the Editing Functionality
165
250
166
251
The following example demonstrates how to enable the ListView editing.
167
252
253
+ > In the ListView TagHelper the editing is enabled by the ` edit-template ` configuration.
254
+
168
255
``` HtmlHelper
169
256
@(Html.Kendo().ListView<ListViewExample.Models.OrderViewModel>()
170
257
.Name("listView")
@@ -173,6 +260,33 @@ The following example demonstrates how to enable the ListView editing.
173
260
.Editable() //<-- Enable editing.
174
261
)
175
262
```
263
+ {% if site.core %}
264
+ ``` TagHelper
265
+ <kendo-listview name="listView"
266
+ tag-name="div"
267
+ template-id="template"
268
+ edit-template-id="editTemplate">
269
+ <datasource type="DataSourceTagHelperType.Ajax" page-size="4">
270
+ <transport>
271
+ <create url="@Url.Action("Orders_Create", "ListView")" />
272
+ <read url="@Url.Action("Orders_Read", "ListView")" />
273
+ <update url="@Url.Action("Orders_Update", "ListView")" />
274
+ <destroy url="@Url.Action("Orders_Destroy", "ListView" )" />
275
+ </transport>
276
+ <schema>
277
+ <model id="ProductID">
278
+ <fields>
279
+ <field name="ProductName"></field>
280
+ <field name="UnitPrice"></field>
281
+ <field name="UnitsInStock"></field>
282
+ <field name="Discontinued"></field>
283
+ </fields>
284
+ </model>
285
+ </schema>
286
+ </datasource>
287
+ </kendo-listview>
288
+ ```
289
+ {% endif %}
176
290
177
291
## Specifying the Action Methods
178
292
@@ -198,6 +312,28 @@ The following example demonstrates how to specify the action methods which will
198
312
.Pageable()
199
313
)
200
314
```
315
+ {% if site.core %}
316
+ ``` TagHelper
317
+ <kendo-listview name="listView"
318
+ tag-name="div"
319
+ template-id="template"
320
+ edit-template-id="editTemplate">
321
+ <datasource type="DataSourceTagHelperType.Ajax" page-size="4">
322
+ <transport>
323
+ <create url="@Url.Action("Orders_Create", "ListView")" />
324
+ <read url="@Url.Action("Orders_Read", "ListView")" />
325
+ <update url="@Url.Action("Orders_Update", "ListView")" />
326
+ <destroy url="@Url.Action("Orders_Destroy", "ListView" )" />
327
+ </transport>
328
+ <schema>
329
+ <model id="ProductID"></model>
330
+ </schema>
331
+ </datasource>
332
+ <pageable enabled="true"/>
333
+ </kendo-listview>
334
+ ```
335
+ {% endif %}
336
+
201
337
202
338
For a quick test add a static list and copy and paste it in the controller, or use own service or data base which returns an ` IEnumerable ` or ` IQueriable ` .
203
339
0 commit comments