Skip to content

Commit be6b133

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 24ae02a commit be6b133

File tree

7 files changed

+306
-98
lines changed

7 files changed

+306
-98
lines changed

docs-aspnet/html-helpers/data-management/grid/appearance/component-type.md

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,63 @@
1-
---
2-
title: Column Menu
3-
page_title: Column Menu
4-
description: "Get started with the {{ site.product_short }} Grid by Kendo UI and learn how to enable its column menu."
5-
slug: columnmenu_aspnet_grid
6-
position: 6
7-
---
8-
9-
# Column Menu
10-
11-
The Grid provides a built-in option for triggering column operations through a menu.
12-
13-
To enable the column-menu implementation, use the `ColumnMenu(true)` method. As a result, the column headers of the Grid render a column menu which allows the user to sort, filter, or change the visibility of the column. The column menu also detects when a specific column operation is disabled through the column definition and excludes the corresponding UI from its rendering. For a runnable example, refer to the [demo on implementing a column menu in the Grid](https://demos.telerik.com/{{site.platform}}/grid/column-menu).
14-
15-
## Configuration
16-
17-
The `ColumnMenu()` method accepts a `GridColumnMenuSettingsBuilder` that enables grouping of the columns in the menu. The `Sort()` method can be used to sort the columns by passing `asc` or `desc` as a parameter. The columns are not sorted by default, they have the same order as the columns in the grid.
18-
19-
The `Columns()` group method expects a collection of the model properties. The menu will automatically use the title from the grid columns if such is defined.
20-
21-
22-
```
23-
.ColumnMenu(menu=>
24-
menu.Columns(columns => {
25-
columns
26-
.Sort("asc")
27-
.Groups(groups =>
28-
{
29-
groups.Add().Title("Order ID").Columns(new List<string> { "OrderID" }); ;
30-
groups.Add().Title("Address").Columns(new List<string> { "ShipCountry", "ShipName", "ShipAddress"});
31-
});
32-
})
33-
)
34-
```
35-
36-
## See Also
37-
38-
* [Column Menu by the Grid (Demo)](https://demos.telerik.com/{{site.platform}}/grid/column-menu)
1+
---
2+
title: Column Menu
3+
page_title: Column Menu
4+
description: "Get started with the {{ site.product_short }} Grid by Kendo UI and learn how to enable its column menu."
5+
slug: columnmenu_aspnet_grid
6+
position: 6
7+
---
8+
9+
# Column Menu
10+
11+
The column menu allows users to quickly access column-related operations like sorting and filtering.
12+
13+
To enable the column menu, use the `ColumnMenu(true)` method. As a result, the column headers of the Grid render a column menu, which allows the user to sort, filter, or change the visibility of a column. The column menu also detects when a specific column operation is disabled through the column definition and excludes the corresponding UI from rendering. For a runnable example, refer to the [demo on implementing a column menu in the Grid](https://demos.telerik.com/{{site.platform}}/grid/column-menu).
14+
15+
## Sort
16+
17+
The column menu allows you to control the visibility of each Grid column. For this purpose, the column menu renders a child column menu with a checkbox for each Grid column.
18+
By default, the Grid column titles in the child column menu are not sorted. They have the same order as the columns in the Grid. To sort the column titles in the child menu, use the `ColumnMenu()` method.
19+
20+
The below example demonstrates how to sort the column titles in the child menu in ascending order:
21+
22+
```
23+
.ColumnMenu(menu=>
24+
menu.Columns(columns => columns.Sort("asc"))
25+
)
26+
```
27+
28+
## Group
29+
30+
The `ColumnMenu()` method accepts a `GridColumnMenuSettingsBuilder` that enables grouping of the columns in the child menu. The `Columns()` group method expects a collection of the model properties. The menu will automatically use the title of the grid columns if such is defined
31+
32+
The following example demonstrates how to group columns by providing the model fields in a list of strings:
33+
34+
```
35+
.ColumnMenu(menu=>
36+
menu.Columns(columns => {
37+
columns.Groups(groups =>
38+
{
39+
groups.Add().Title("Order ID").Columns(new List<string> { "OrderID" }); ;
40+
groups.Add().Title("Address").Columns(new List<string> { "ShipCountry", "ShipName", "ShipAddress"});
41+
});
42+
})
43+
)
44+
```
45+
46+
## Column Menu Types
47+
48+
As of R1 2021 version of the Telerik UI for {{ site.framework }} suite, the Grid component introduces the `modern` render mode that aims to deliver a fresh look and feel.
49+
50+
By default, the column menu of the Grid is initialized in the `classic` render mode. To set it to `modern`, configure the options of the widget as follows:
51+
52+
```
53+
@(Html.Kendo().Grid()
54+
.Name("datePicker")
55+
.ColumnMenu(m=>{
56+
m.ComponentType("modern");
57+
})
58+
)
59+
```
60+
61+
## See Also
62+
63+
* [Column Menu by the Grid (Demo)](https://demos.telerik.com/{{site.platform}}/grid/column-menu)

docs/controls/data-management/grid/appearance/adaptive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ page_title: jQuery Grid Documentation | Adaptive Rendering
44
description: "Get started with the jQuery Grid by Kendo UI which provides consistency to the customer experience on any device by supporting adaptive rendering."
55
previous_url: /controls/data-management/grid/adaptive
66
slug: adaptive_rendering_kendoui_grid_widget
7-
position: 6
7+
position: 5
88
---
99

1010
# Adaptive Rendering

docs/controls/data-management/grid/appearance/component-type.md

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

docs/controls/data-management/grid/columns/column-menu.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ position: 5
1010

1111
The Grid provides a built-in option for triggering column operations through a menu.
1212

13-
To enable the column-menu implementation, set [`columnMenu:true`](/api/javascript/ui/grid/configuration/columnmenu). As a result, the column headers of the Grid render a column menu which allows the user to sort, filter, or change the visibility of the column. The column menu also detects when a specific column operation is disabled through the column definition and excludes the corresponding UI from its rendering. For a runnable example, refer to the [demo on implementing a column menu in the Grid](https://demos.telerik.com/kendo-ui/grid/column-menu).
13+
To enable the column menu implementation, set [`columnMenu:true`](/api/javascript/ui/grid/configuration/columnmenu). As a result, the column headers of the Grid render a column menu, which allows the user to sort, filter, or change the visibility of a column. The column menu also detects when a specific column operation is disabled through the column definition and excludes the corresponding UI from its rendering. For a runnable example, refer to the [demo on implementing a column menu in the Grid](https://demos.telerik.com/kendo-ui/grid/column-menu).
14+
15+
Further information about the available columnMenu configuration properties can be obtained from this [`API article`](/api/javascript/ui/grid/configuration/columnmenu).
16+
1417

1518
## Sort
1619

17-
To sort the columns in the column menu, use the `columns.sort` configuration with `asc` or `desc` as the value. The columns are not sorted by default, they have the same order as the columns in the grid:
20+
By default, the Grid column titles in the child column menu are not sorted. They have the same order as the columns in the Grid. To sort the column titles in the child menu, use the `columns.sort` configuration with `asc` or `desc` as the value..
1821

1922
```
2023
columnMenu: {
@@ -39,6 +42,20 @@ The `columnMenu` configuration setting accepts a `columns.groups` array that ena
3942
}
4043
```
4144

45+
# Column Menu Types
46+
47+
As of R1 2021 version of the Kendo UI suite, the Grid widget introduces the `modern` render mode that aims to deliver a fresh look and feel. It aims to enhance the existing rendering and deliver a fresh and modern look and feel.
48+
49+
By default, the column menu of the Grid is initialized in the `classic` render mode. To set it to `modern`, configure the options of the widget as follows:
50+
51+
```
52+
$("#grid").kendoGrid({
53+
columnMenu:{
54+
componentType:"modern"
55+
}
56+
});
57+
```
58+
4259
## KB Articles on Column Menu
4360

4461
* [Using Checkboxes inside the Column Menu]({% slug howto_use_checkboxes_inside_column_menu_grid %})

src/kendo.data.js

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4199,6 +4199,7 @@ var __meta__ = { // jshint ignore:line
41994199
group.excludeHeader = true;
42004200
} else if (options.includeParents) {
42014201
options.taken++;
4202+
group.excludeHeader = false;
42024203
}
42034204

42044205
if (group.hasSubgroups && group.items && group.items.length) {
@@ -4252,6 +4253,55 @@ var __meta__ = { // jshint ignore:line
42524253
}
42534254
},
42544255

4256+
_expandedSubGroupItemsCount: function (group, end, includeCurrentItems) {
4257+
var that = this;
4258+
var result = 0;
4259+
var subGroup;
4260+
var endSpecified = typeof end === "number";
4261+
var length = endSpecified ? end : group.subgroupCount;
4262+
var temp;
4263+
4264+
if (!group.hasSubgroups) {
4265+
return result;
4266+
}
4267+
4268+
for (var i = 0; i < length; i++) {
4269+
subGroup = group.items[i];
4270+
4271+
if (!subGroup) {
4272+
break;
4273+
}
4274+
4275+
if (subGroup.hasSubgroups && that._groupsState[group.uid]) {
4276+
temp = that._expandedSubGroupItemsCount(subGroup, length, true);
4277+
result += temp;
4278+
4279+
if (endSpecified) {
4280+
length -= temp;
4281+
}
4282+
} else if (!subGroup.hasSubgroups && that._groupsState[subGroup.uid]) {
4283+
temp = subGroup.items ? subGroup.items.length : 0;
4284+
result += temp;
4285+
if (endSpecified) {
4286+
length -= temp;
4287+
}
4288+
}
4289+
4290+
if (includeCurrentItems) {
4291+
result += 1;
4292+
if (endSpecified) {
4293+
length -= 1;
4294+
}
4295+
}
4296+
4297+
if (endSpecified && result > length) {
4298+
return result;
4299+
}
4300+
}
4301+
4302+
return result;
4303+
},
4304+
42554305
_fetchGroupItems: function(group, options, parents, callback) {
42564306
var that = this;
42574307
var groupItemsSkip;
@@ -4261,24 +4311,30 @@ var __meta__ = { // jshint ignore:line
42614311
var take = options.take;
42624312
var skipped = options.skipped;
42634313
var pageSize = that.take();
4314+
var expandedSubGroupItemsCount;
42644315

42654316
if (options.includeParents) {
4266-
take -= 1;
4267-
skipped += 1;
4317+
if (skipped < options.skip) {
4318+
skipped += 1;
4319+
} else {
4320+
take -= 1;
4321+
}
42684322
}
42694323

42704324
if (!group.items || (group.items && !group.items.length)) {
42714325
that.getGroupItems(group, options, parents, callback, 0);
42724326
return true;
42734327
} else {
4274-
groupItemsSkip = Math.max(options.skip - skipped, 0);
4275-
firstItem = group.items[groupItemsSkip];
4276-
lastItem = group.items[Math.min(groupItemsSkip + take - 1, groupItemCount - 1)];
4328+
expandedSubGroupItemsCount = this._expandedSubGroupItemsCount(group, options.skip - skipped);
4329+
groupItemsSkip = Math.max(options.skip - (skipped + expandedSubGroupItemsCount), 0);
42774330

42784331
if (groupItemsSkip >= groupItemCount) {
42794332
return false;
42804333
}
42814334

4335+
firstItem = group.items[groupItemsSkip];
4336+
lastItem = group.items[Math.min(groupItemsSkip + take, groupItemCount - 1)];
4337+
42824338
if (firstItem.notFetched) {
42834339
that.getGroupItems(group, options, parents, callback, math.max(math.floor(groupItemsSkip / pageSize), 0) * pageSize);
42844340
return true;
@@ -4448,11 +4504,13 @@ var __meta__ = { // jshint ignore:line
44484504
var range;
44494505
var dataLength;
44504506
var indexes;
4507+
var currIdx;
44514508

44524509
for (var i = 0; i < rangesLength; i++) {
44534510
range = ranges[i];
44544511
dataLength = range.data.length;
44554512
indexes = [];
4513+
temp = null;
44564514

44574515
for (var j = 0; j < dataLength; j++) {
44584516
currentGroup = range.data[j];
@@ -4468,7 +4526,8 @@ var __meta__ = { // jshint ignore:line
44684526
temp = ranges[i].pristineData;
44694527

44704528
while (indexes.length > 1) {
4471-
temp = temp[indexes.splice(0, 1)[0]].items;
4529+
currIdx = indexes.splice(0, 1)[0];
4530+
temp = temp[currIdx].items;
44724531
}
44734532
temp[indexes[0]] = that._cloneGroup(group);
44744533
break;

0 commit comments

Comments
 (0)