Skip to content

Commit 5b139fc

Browse files
committed
Sync with Kendo UI Professional
1 parent 048bd88 commit 5b139fc

File tree

15 files changed

+404
-278
lines changed

15 files changed

+404
-278
lines changed

docs-aspnet/_config.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ start-docs.sh,
2828
watch.sh,
2929
getting-started-mvc/*,
3030
html-helpers/helper-basics/build-team-efficiency-dashboard/*,
31-
how-to/*,
3231
tutorials/*,
3332
troubleshoot/troubleshooting.md,
3433
troubleshoot/troubleshooting-validation.md,
@@ -66,17 +65,14 @@ html-helpers/editors/autocomplete/how-to/*,
6665
html-helpers/editors/colorpicker/how-to/*,
6766
html-helpers/editors/datepicker/how-to/*,
6867
html-helpers/editors/dropdownlist/how-to/*,
69-
html-helpers/editors/multiselect/how-to/*,
7068
html-helpers/interactivity/progressbar/how-to/*,
7169
html-helpers/layout/window/how-to/*,
7270
html-helpers/navigation/menu/how-to/*,
73-
html-helpers/navigation/panelbar/how-to/*,
74-
html-helpers/navigation/treeview/how-to/*,
75-
html-helpers/scheduling/scheduler/how-to/*,
7671
tag-helpers/*,
7772
knowledge-base/switch-change-messages-inside-grid.md,
7873
knowledge-base/upload-files-to-database.md,
79-
knowledge-base/treeview-expand-node-async]
74+
knowledge-base/treeview-expand-node-async,
75+
knowledge-base/mvc-with-requirejs.md]
8076

8177
exclude_navigation: ["knowledge-base/*",
8278
api/kendo.mvc/*,

docs-aspnet/how-to/define-custom-helper-methods-for-mvc.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs-aspnet/how-to/refer-from-cdn-local-script-fallback-mvc.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs-aspnet/how-to/use-with-aspnet-bundles.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs-aspnet/how-to/use-with-requirejs-mvc.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs-aspnet/html-helpers/data-management/grid/toolbar.md

Lines changed: 98 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ You can configure the Toolbar and include any of the built-in commands:
5858

5959
## Custom Commands
6060

61-
The {{site.product}} Grid supports adding custom commands to it's Toolbar.
61+
The Toolbar of the Grid component supports custom commands.
6262

6363
The following example demonstrates how to add a custom command to the Toolbar:
6464
```HtmlHelper
@@ -68,10 +68,9 @@ The following example demonstrates how to add a custom command to the Toolbar:
6868
6969
<script>
7070
$(document).ready(function(){
71-
$("#customCommand").click(function (e) {
72-
e.preventDefault();
73-
alert('click')
74-
//add custom command logic here
71+
$("#customCommand").on("click", function(event) {
72+
alert('Custom command is clicked.');
73+
// Add the custom command logic here.
7574
});
7675
})
7776
</script>
@@ -84,10 +83,9 @@ The following example demonstrates how to add a custom command to the Toolbar:
8483
8584
<script>
8685
$(document).ready(function(){
87-
$(".k-grid-customCommand").click(function (e) {
88-
e.preventDefault();
89-
alert('click')
90-
//add custom command logic here
86+
$(".k-grid-customCommand").on("click", function(event) {
87+
alert('Custom command is clicked.');
88+
// Add the custom command logic here.
9189
});
9290
})
9391
</script>
@@ -97,27 +95,61 @@ The following example demonstrates how to add a custom command to the Toolbar:
9795

9896
## Toolbar Template
9997

100-
The {{site.product}} Grid also supports using a template for the Toolbar. You can define a template by using the [`ClientTemplate()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory#clienttemplatesystemstring) or the [`ClientTemplateid()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory#clienttemplateidsystemstring) configuration options.{% if site.core %} For TagHelper Grid configuration use the `client-template` or `client-template-id` properties.
101-
{% endif %}
98+
The Grid also supports using a template for the Toolbar. {% if site.core %}You can define the template as a string or an [external Kendo UI template](https://docs.telerik.com/kendo-ui/framework/templates/get-started-external), load it through a partial view, or return its content using a JavaScript function.{% else %}You can define the template as a string or return its content using a JavaScript function.{% endif %} For more information on the available template options, refer to the [`ToolBar()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory) API.
99+
100+
{% if site.core %}
101+
The following example shows how to create a template for the Toolbar using an [external Kendo UI template](https://docs.telerik.com/kendo-ui/framework/templates/get-started-external).
102102

103103
```HtmlHelper
104104
.ToolBar(toolbar => {
105105
toolbar.ClientTemplateId("GridToolbarTemplate");
106106
})
107107
```
108-
{% if site.core %}
109108
```TagHelper
110109
<toolbar client-template-id="GridToolbarTemplate">
111110
</toolbar>
112111
```
113-
{% endif %}
112+
```GridToolbarTemplate
113+
<script id="GridToolbarTemplate" type="text/x-kendo-template">
114+
<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base">Custom command</button>
115+
</script>
116+
```
117+
{% else %}
118+
The following example shows how to create a template for the Toolbar using the `ClientTemplateHandler()` option, which returns an [external Kendo UI template](https://docs.telerik.com/kendo-ui/framework/templates/get-started-external).
119+
120+
```HtmlHelper
121+
.ToolBar(toolbar => {
122+
toolbar.ClientTemplateHandler("getToolbarTemplate");
123+
})
124+
```
125+
```JS
126+
<script id="GridToolbarTemplate" type="text/x-kendo-template">
127+
<button class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base">Custom command</button>
128+
</script>
129+
130+
<script>
131+
function getToolbarTemplate(data) {
132+
var template = $("#GridToolbarTemplate").html();
133+
return template;
134+
}
135+
</script>
136+
```
137+
{% endif %}
138+
139+
### Built-In and Custom Commands in the Toolbar Template
114140

115-
When you use a Toolbar Template, and you also want to use a built-in command, then add the markup for the desired command. The following example demonstrates how to add the `Pdf` and `Search` commands to the Toolbar Template.
141+
To use the built-in commands in the Toolbar template, add the `HTML` markup of the respective command.
142+
143+
The following example demonstrates how to add the built-in `Pdf` and `Search` commands together with custom commands to the Toolbar template.
116144

117145
```HtmlHelper
118146
<script id="GridToolbarTemplate" type="text/x-kendo-template">
119147
<div class="refreshBtnContainer">
120-
<a href="\\#" class="k-pager-refresh k-link k-button k-button-solid-base k-button-solid k-button-md k-rounded-md k-button-icon" title="Refresh"><span class="k-icon k-i-reload"></span></a>
148+
@(Html.Kendo().Button()
149+
.Name("refresh")
150+
.Icon("arrow-rotate-cw")
151+
.ToClientTemplate()
152+
)
121153
</div>
122154
123155
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-md k-rounded-md k-button-icontext k-grid-pdf" href="\\#"><span class="k-icon k-i-file-pdf"></span>Export to PDF</a>
@@ -150,20 +182,20 @@ When you use a Toolbar Template, and you also want to use a built-in command, th
150182
```TagHelper
151183
<script id="GridToolbarTemplate" type="text/html">
152184
<div class="refreshBtnContainer">
153-
<a href="\\#" class="k-pager-refresh k-link k-button k-button-solid-base k-button-solid k-button-rectangle k-button-md k-rounded-md k-button-icon" title="Refresh"><span class="k-icon k-i-reload"></span></a>
185+
<kendo-button name="refresh" icon="arrow-rotate-cw" is-in-client-template="true">
186+
</kendo-button>
154187
</div>
155188
156189
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-md k-rounded-md k-button-icontext k-grid-pdf" href="\\#"><span class="k-icon k-i-file-pdf"></span>Export to PDF</a>
157190
158191
<div class="toolbar">
159192
<label class="category-label" for="category">Show products by category:</label>
160-
<kendo-dropdownlist name="categories" style="width:150px"
161-
datatextfield="CategoryName"
162-
datavaluefield="CategoryId"
163-
option-label="All"
164-
auto-bind="false"
165-
on-change="categoriesChange"
166-
is-in-client-template="true">
193+
<kendo-dropdownlist name="categories" style="width:150px" is-in-client-template="true"
194+
datatextfield="CategoryName"
195+
datavaluefield="CategoryId"
196+
option-label="All"
197+
auto-bind="false"
198+
on-change="categoriesChange">
167199
<datasource type="DataSourceTagHelperType.Custom">
168200
<transport>
169201
<read url="@Url.Action("ToolbarTemplate_Categories", "Grid")" />
@@ -180,9 +212,9 @@ When you use a Toolbar Template, and you also want to use a built-in command, th
180212
```
181213
{% endif %}
182214

183-
As of {{site.product}} `R3 2023 SP1` release you can use the [Template component]({% slug htmlhelpers_overview_template %}) to define custom ToolBar commands, alongside the default ToolBar commands.
215+
Starting with version R3 2023 SP1, you can use the [Template component]({% slug htmlhelpers_overview_template %}) to define custom Toolbar commands alongside the default ones.
184216

185-
The following example demonstrates how you can add a Button and DropDownList components to the Grid's Toolbar, along with a default `Excel` command demonstrated in the [{{site.product}} Grid Toolbar Template Demo](https://demos.telerik.com/{{site.platform}}/grid/toolbar-template).
217+
The following example demonstrates how you can add [Button]({% slug htmlhelpers_button_aspnetcore %}) and [DropDownList]({% slug htmlhelpers_dropdownlist_aspnetcore %}) components to the Grid's Toolbar, along with the default `Excel` command. For a live example, visit the [Toolbar Template Demo of the Grid](https://demos.telerik.com/{{site.platform}}/grid/toolbar-template).
186218

187219
```HtmlHelper
188220
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
@@ -225,7 +257,7 @@ The following example demonstrates how you can add a Button and DropDownList com
225257
<toolbar>
226258
<toolbar-button>
227259
<toolbar-command-template>
228-
<kendo-button name="iconButton" icon="arrow-rotate-cw" on-click="refresh">
260+
<kendo-button name="refresh" icon="arrow-rotate-cw" on-click="refresh">
229261
</kendo-button>
230262
</toolbar-command-template>
231263
</toolbar-button>
@@ -234,11 +266,11 @@ The following example demonstrates how you can add a Button and DropDownList com
234266
<toolbar-command-template>
235267
<label class="category-label" for="category">Show products by category:</label>
236268
<kendo-dropdownlist name="categories" style="width:150px"
237-
datatextfield="CategoryName"
238-
datavaluefield="CategoryID"
239-
option-label="All"
240-
auto-bind="false"
241-
on-change="categoriesChange">
269+
datatextfield="CategoryName"
270+
datavaluefield="CategoryID"
271+
option-label="All"
272+
auto-bind="false"
273+
on-change="categoriesChange">
242274
<datasource type="DataSourceTagHelperType.Custom">
243275
<transport>
244276
<read url="@Url.Action("ToolbarTemplate_Categories", "Grid")" />
@@ -273,54 +305,57 @@ The following example demonstrates how you can add a Button and DropDownList com
273305
```
274306

275307
{% if site.mvc %}
276-
### Server-side rendering of the ToolBar Template
308+
### Server-Side Rendering of the Toolbar Template
309+
310+
Rendering of the Toolbar on the server is supported by using the [`Template()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory#templatesystemaction) configuration option.
277311

278-
Rendering of the Toolbar on the server is supported by using the [`.Template()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory#templatesystemaction) configuration. The following example demonstrates how to define a server-side ToolBar Template.
312+
The following example demonstrates how to define a server-side Toolbar template.
279313

280314
```HtmlHelper
281315
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
282316
.Name("grid")
283317
.ToolBar(toolbar =>
284318
{
285319
toolbar.Template(@<text>
286-
<div class="refreshBtnContainer">
287-
<a href="\\#" class="k-pager-refresh k-link k-button k-button-solid-base k-button-solid k-button-md k-rounded-md" title="Refresh"><span class="k-button-icon k-icon k-i-reload"></span></a>
288-
</div>
289-
<div class="toolbar">
290-
<label class="category-label" for="category">Show products by category:</label>
291-
@(Html.Kendo().DropDownList()
292-
.Name("categories")
293-
.OptionLabel("All")
294-
.DataTextField("CategoryName")
295-
.DataValueField("CategoryID")
296-
.AutoBind(false)
297-
.Events(e => e.Change("categoriesChange"))
298-
.HtmlAttributes(new { style = "width: 150px;" })
299-
.DataSource(ds =>
300-
{
301-
ds.Read("ToolbarTemplate_Categories", "Grid");
302-
})
303-
)
304-
</div>
320+
<div class="refreshBtnContainer">
321+
<a href="\\#" class="k-pager-refresh k-link k-button k-button-solid-base k-button-solid k-button-md k-rounded-md" title="Refresh"><span class="k-button-icon k-icon k-i-reload"></span></a>
322+
</div>
323+
<div class="toolbar">
324+
<label class="category-label" for="category">Show products by category:</label>
325+
@(Html.Kendo().DropDownList()
326+
.Name("categories")
327+
.OptionLabel("All")
328+
.DataTextField("CategoryName")
329+
.DataValueField("CategoryID")
330+
.AutoBind(false)
331+
.Events(e => e.Change("categoriesChange"))
332+
.HtmlAttributes(new { style = "width: 150px;" })
333+
.DataSource(ds =>
334+
{
335+
ds.Read("ToolbarTemplate_Categories", "Grid");
336+
})
337+
)
338+
</div>
305339
</text>);
306340
})
341+
... // Additional configuration.
342+
)
307343
```
308344
```JavaScript
309345
<script>
310-
$(document).ready( function () {
346+
$(document).ready(function() {
311347
var grid = $("#grid");
312348
grid.find(".k-grid-toolbar").on("click", ".k-pager-refresh", function (e) {
313349
e.preventDefault();
314350
grid.data("kendoGrid").dataSource.read();
315351
});
316-
317352
});
318353

319354
function categoriesChange() {
320355
var value = this.value(),
321-
grid = $("#grid").data("kendoGrid");
356+
grid = $("#grid").data("kendoGrid");
322357

323-
if (value) {
358+
if(value) {
324359
grid.dataSource.filter({ field: "CategoryID", operator: "eq", value: parseInt(value) });
325360
} else {
326361
grid.dataSource.filter({});
@@ -352,11 +387,13 @@ Rendering of the Toolbar on the server is supported by using the [`.Template()`]
352387
}
353388
</style>
354389
```
355-
356390
{% endif %}
357391

358392
## See Also
359-
* [Batch Editing of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/editing)
360-
* [PopUp Editing of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/editing-popup)
361-
* [Excel Export of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/excel-export)
362-
* [PDF Export of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/pdf-export)
393+
394+
* [Toolbar Template of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/toolbar-template)
395+
* [Toolbar Columns Menu of the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/toolbar-columns-menu)
396+
* [Server-Side API of the Grid HtmlHelper](/api/grid)
397+
{% if site.core %}
398+
* [Server-Side API of the Grid TagHelper](/api/taghelpers/grid)
399+
{% endif %}

0 commit comments

Comments
 (0)