Skip to content

Commit 97ce25e

Browse files
committed
Sync with Kendo UI Professional
1 parent 54c1ab6 commit 97ce25e

File tree

9 files changed

+295
-153
lines changed

9 files changed

+295
-153
lines changed

docs-aspnet/_config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,13 @@ navigation:
700700
baseurl: /aspnet-core
701701

702702
## The Kendo UI version used
703-
cdnVersion: "2024.1.130"
703+
cdnVersion: "2024.1.319"
704704

705705
## The themes CDN used
706-
themesCdnVersion: "7.2.0"
706+
themesCdnVersion: "7.2.1"
707707

708708
## The MVC Core version used
709-
mvcCoreVersion: "2024.1.130"
709+
mvcCoreVersion: "2024.1.319"
710710

711711
ff-sheet-id: 1mottKpkbJFxkUq6rS3CsPrT8JQOE2JlUtsJBR622cxs
712712

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

Lines changed: 89 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,95 @@ The following example demonstrates how to add a custom command to the Toolbar:
9494
```
9595
{% endif %}
9696

97-
As of {{site.product}} R3 2023 SP1 you can use the [Template component]({% slug htmlhelpers_overview_template %}) to define custom ToolBar commands, alongside the default ToolBar commands.
9897

99-
The following example demonstrates how you can add a Button and DropDownList components to the Grid's Toolbar, along with a default `Excel` command:
98+
## Toolbar Template
99+
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 %}
102+
103+
```HtmlHelper
104+
.ToolBar(toolbar => {
105+
toolbar.ClientTemplateId("GridToolbarTemplate");
106+
})
107+
```
108+
{% if site.core %}
109+
```TagHelper
110+
<toolbar client-template-id="GridToolbarTemplate">
111+
</toolbar>
112+
```
113+
{% endif %}
114+
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.
116+
117+
```HtmlHelper
118+
<script id="GridToolbarTemplate" type="text/x-kendo-template">
119+
<div class="refreshBtnContainer">
120+
<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>
121+
</div>
122+
123+
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-rectangle 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>
124+
125+
<div class="toolbar">
126+
<label class="category-label" for="category">Show products by category:</label>
127+
@(Html.Kendo().DropDownList()
128+
.Name("categories")
129+
.OptionLabel("All")
130+
.DataTextField("CategoryName")
131+
.DataValueField("CategoryID")
132+
.AutoBind(false)
133+
.Events(e => e.Change("categoriesChange"))
134+
.HtmlAttributes(new { style = "width: 150px;" })
135+
.DataSource(ds =>
136+
{
137+
ds.Read("ToolbarTemplate_Categories", "Grid");
138+
})
139+
.ToClientTemplate()
140+
)
141+
</div>
142+
143+
<span class="k-textbox k-grid-search k-display-flex">
144+
<input autocomplete="off" placeholder="Search..." title="Search..." class="k-input">
145+
<span class="k-input-icon"><span class="k-icon k-i-search"></span></span>
146+
</span>
147+
</script>
148+
```
149+
{% if site.core %}
150+
```TagHelper
151+
<script id="GridToolbarTemplate" type="text/html">
152+
<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>
154+
</div>
155+
156+
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-rectangle 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>
157+
158+
<div class="toolbar">
159+
<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">
167+
<datasource type="DataSourceTagHelperType.Custom">
168+
<transport>
169+
<read url="@Url.Action("ToolbarTemplate_Categories", "Grid")" />
170+
</transport>
171+
</datasource>
172+
</kendo-dropdownlist>
173+
</div>
174+
175+
<span class="k-textbox k-grid-search k-display-flex">
176+
<input autocomplete="off" placeholder="Search..." title="Search..." class="k-input">
177+
<span class="k-input-icon"><span class="k-icon k-i-search"></span></span>
178+
</span>
179+
</script>
180+
```
181+
{% endif %}
182+
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.
184+
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).
100186

101187
```HtmlHelper
102188
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
@@ -186,95 +272,10 @@ The following example demonstrates how you can add a Button and DropDownList com
186272
</script>
187273
```
188274

189-
## Toolbar Template
190-
191-
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.
192-
{% endif %}
193-
194-
```HtmlHelper
195-
.ToolBar(toolbar => {
196-
toolbar.ClientTemplateId("GridToolbarTemplate");
197-
})
198-
```
199-
{% if site.core %}
200-
```TagHelper
201-
<toolbar client-template-id="GridToolbarTemplate">
202-
</toolbar>
203-
```
204-
{% endif %}
205-
206-
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 demonstrated in the [{{site.product}} Grid Toolbar Template Demo](https://demos.telerik.com/{{site.platform}}/grid/toolbar-template).
207-
208-
```HtmlHelper
209-
<script id="GridToolbarTemplate" type="text/x-kendo-template">
210-
<div class="refreshBtnContainer">
211-
<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>
212-
</div>
213-
214-
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-rectangle 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>
215-
216-
<div class="toolbar">
217-
<label class="category-label" for="category">Show products by category:</label>
218-
@(Html.Kendo().DropDownList()
219-
.Name("categories")
220-
.OptionLabel("All")
221-
.DataTextField("CategoryName")
222-
.DataValueField("CategoryID")
223-
.AutoBind(false)
224-
.Events(e => e.Change("categoriesChange"))
225-
.HtmlAttributes(new { style = "width: 150px;" })
226-
.DataSource(ds =>
227-
{
228-
ds.Read("ToolbarTemplate_Categories", "Grid");
229-
})
230-
.ToClientTemplate()
231-
)
232-
</div>
233-
234-
<span class="k-textbox k-grid-search k-display-flex">
235-
<input autocomplete="off" placeholder="Search..." title="Search..." class="k-input">
236-
<span class="k-input-icon"><span class="k-icon k-i-search"></span></span>
237-
</span>
238-
</script>
239-
```
240-
{% if site.core %}
241-
```TagHelper
242-
<script id="GridToolbarTemplate" type="text/html">
243-
<div class="refreshBtnContainer">
244-
<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>
245-
</div>
246-
247-
<a role="button" class="k-button k-button-solid-base k-button-solid k-button-rectangle 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>
248-
249-
<div class="toolbar">
250-
<label class="category-label" for="category">Show products by category:</label>
251-
<kendo-dropdownlist name="categories" style="width:150px"
252-
datatextfield="CategoryName"
253-
datavaluefield="CategoryId"
254-
option-label="All"
255-
auto-bind="false"
256-
on-change="categoriesChange"
257-
is-in-client-template="true">
258-
<datasource type="DataSourceTagHelperType.Custom">
259-
<transport>
260-
<read url="@Url.Action("ToolbarTemplate_Categories", "Grid")" />
261-
</transport>
262-
</datasource>
263-
</kendo-dropdownlist>
264-
</div>
265-
266-
<span class="k-textbox k-grid-search k-display-flex">
267-
<input autocomplete="off" placeholder="Search..." title="Search..." class="k-input">
268-
<span class="k-input-icon"><span class="k-icon k-i-search"></span></span>
269-
</span>
270-
</script>
271-
```
272-
{% endif %}
273-
274275
{% if site.mvc %}
275276
### Server-side rendering of the ToolBar Template
276277

277-
Rendering of the Toolbar on the server is supported via the [`.Template()`](/api/kendo.mvc.ui.fluent/gridtoolbarcommandfactory#templatesystemaction) configuration. The following example demonstrates how to define a server-side ToolBar Template:
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.
278279

279280
```HtmlHelper
280281
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: Customizing the Grid Pager's DropDown
3+
description: Learn how to customize the pagination DropDownL in the {{ site.product }} Grid footer to load all pages by default.
4+
type: how-to
5+
page_title: How to Customize {{ site.product }} Grid Footer Pagination to Load All Pages by Default
6+
slug: customize-kendo-ui-grid-footer-pagination-load-all-pages
7+
tags: kendo-ui-grid, pagination, customization, drop-down, default, telerik, aspnet-mvc, aspnet-core
8+
res_type: kb
9+
---
10+
11+
## Environment
12+
| Property | Value |
13+
| --- | --- |
14+
| Product | {{ site.product }} Grid |
15+
| Version | 2022.2.621 |
16+
17+
## Description
18+
I would like to customize the pagination drop-down in the {{ site.product }} Grid Grid footer to load all pages by default. How can I achieve this?
19+
20+
## Solution
21+
To customize the pagination drop-down in the {{ site.product }} Grid Grid footer to load all pages by default, follow these steps:
22+
23+
1. Hide the default pager by adding the following CSS code:
24+
25+
```css
26+
.k-grid-pager {
27+
display: none;
28+
}
29+
```
30+
31+
2. Implement a custom div element that will serve as the custom pager. For example:
32+
33+
```html
34+
<div id="customPager"></div>
35+
```
36+
37+
3. In the [`document.ready`](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/datasource) scope, retrieve the [`dataSource`](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/datasource) instance of the {{ site.product }} Grid Grid.
38+
39+
4. Handle the [`dataBound`](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/databound) Event of the Grid.
40+
41+
5. In the Event handler, Use the [`totalPages`](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/methods/totalpages) method of the `dataSource` to get the page count of the Grid.
42+
43+
6. Implement a DropDownList using the custom div element from step 2, with items ranging from 1 to the page count obtained in step 4.
44+
45+
7. Attach a [`change`](https://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist/events/change) event handler to the DropDownList.
46+
47+
8. In the event handler, retrieve the current value of the DropDownList and set it as the current page of the Grid using the [`page`](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/methods/page) method of the `dataSource`.
48+
49+
Here is an example implementation:
50+
51+
```html
52+
<!-- Custom div element for our pager and hiding the default one -->
53+
<div id="customPager"></div>
54+
55+
<style>
56+
.k-grid-pager {
57+
display: none;
58+
}
59+
</style>
60+
61+
<script>
62+
$(document).ready(function () {
63+
var grid = $("#grid").data("kendoGrid");
64+
65+
// Attach an event handler to the dataBound event
66+
grid.bind("dataBound", function(e) {
67+
var pages = e.sender.dataSource.totalPages();
68+
var ddlData = [];
69+
70+
for (var i = 1; i <= pages; i++) {
71+
ddlData.push(i);
72+
}
73+
74+
// Check if the dropdown is already initialized to avoid re-initializing
75+
var customPager = $("#customPager").data("kendoDropDownList");
76+
if (!customPager) {
77+
$("#customPager").kendoDropDownList({
78+
dataSource: ddlData,
79+
change: onChange
80+
});
81+
} else {
82+
// If already initialized, just update its data
83+
customPager.setDataSource(ddlData);
84+
customPager.refresh();
85+
}
86+
});
87+
});
88+
89+
function onChange() {
90+
var ddl = this;
91+
var currPage = ddl.value();
92+
var grid = $("#grid").data("kendoGrid");
93+
grid.dataSource.page(currPage);
94+
}
95+
</script>
96+
```
97+
98+
## REPL examples
99+
100+
* [HtmlHelper](https://netcorerepl.telerik.com/GekHvdFq26Yj5vdj54)
101+
* [TagHelper](https://netcorerepl.telerik.com/cekRPHlK28SgNOy332)
102+
103+
## More {{ site.framework }} Grid Resources
104+
105+
* [{{ site.framework }} Grid Documentation]({%slug htmlhelpers_grid_aspnetcore_overview%})
106+
* [{{ site.framework }} Grid Demos](https://demos.telerik.com/{{ site.platform }}/grid/index)
107+
{% if site.core %}
108+
* [{{ site.framework }} Grid Product Page](https://www.telerik.com/aspnet-core-ui/grid)
109+
* [Telerik UI for {{ site.framework }} Video Onboarding Course (Free for trial users and license holders)]({%slug virtualclass_uiforcore%})
110+
* [Telerik UI for {{ site.framework }} Forums](https://www.telerik.com/forums/aspnet-core-ui)
111+
{% else %}
112+
* [{{ site.framework }} Grid Product Page](https://www.telerik.com/aspnet-mvc/grid)
113+
* [Telerik UI for {{ site.framework }} Video Onboarding Course (Free for trial users and license holders)]({%slug virtualclass_uiformvc%})
114+
* [Telerik UI for {{ site.framework }} Forums](https://www.telerik.com/forums/aspnet-mvc)
115+
{% endif %}
116+
117+
## See Also
118+
119+
* [Client-Side API Reference of the Grid for {{ site.framework }}](https://docs.telerik.com/kendo-ui/api/javascript/ui/grid)
120+
* [Server-Side API Reference of the Grid for {{ site.framework }}](https://docs.telerik.com/{{ site.platform }}/api/grid)
121+
* [Telerik REPL: Change the Grid Pager to a Slider](https://netcorerepl.telerik.com/cnOGGPlA21RzEjkG12)
122+
* [Telerik UI for {{ site.framework }} Breaking Changes]({%slug breakingchanges_2023%})
123+
* [Telerik UI for {{ site.framework }} Knowledge Base](https://docs.telerik.com/{{ site.platform }}/knowledge-base)

docs/_config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,13 @@ navigation:
703703
baseurl: /kendo-ui
704704

705705
## The Kendo UI version used
706-
cdnVersion: "2024.1.130"
706+
cdnVersion: "2024.1.319"
707707

708708
## The themes CDN used
709-
themesCdnVersion: "7.2.0"
709+
themesCdnVersion: "7.2.1"
710710

711711
## The MVC Core version used
712-
mvcCoreVersion: "2024.1.130"
712+
mvcCoreVersion: "2024.1.319"
713713

714714
## Progress NPM Registry
715715
registry_url: 'https://registry.npm.telerik.com/'

0 commit comments

Comments
 (0)