Skip to content

Commit b5ccf87

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent d1f5019 commit b5ccf87

File tree

4 files changed

+128
-2
lines changed

4 files changed

+128
-2
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: ForeignKey Column
3+
page_title: ForeignKey Column
4+
description: "Get started with the Telerik UI Grid HtmlHelper for {{ site.framework }} and learn how to set up the ForeignKey column."
5+
slug: foreignkeycolumn_aspnetcore_grid
6+
position: 9
7+
---
8+
9+
# ForeignKey Column
10+
11+
The ForeignKey column functionality of the Telerik UI Grid HtmlHelper for {{ site.framework }} is primarily used for matching the value of a bound property to a desired text field from an external for the grid collection. It follows the convention of the SQL ForeignKey functionality that is used for linking two tables based on a foreign key.
12+
13+
The foreign values for the columns of the grid could be supplied in two ways:
14+
15+
* [Binding to a local collection](#binding-to-a-local-collection)
16+
* [Binding to a remote collection](#binding-to-a-remote-collection)
17+
18+
## Binding to a Local Collection
19+
20+
Binding the column to a local collection of items can be done by passing a valid IEnumerable collection to the ForeignKey column configuration
21+
22+
```
23+
columns.ForeignKey(p => p.CategoryID, (System.Collections.IEnumerable)ViewData["categories"], "CategoryID", "CategoryName")
24+
.Title("Category").Width(200);
25+
```
26+
27+
## Binding to a Remote Collection
28+
29+
In order to bind the column to a remote collection of items, supply a URL Action instead of a static collection. It is mandatory to supply the DataValueField and DataTextField options in order to ensure that the column values will be bound to the correct foreign value.
30+
31+
```
32+
columns.ForeignKey(p => p.CategoryID, ds=> ds.Read(r => r.Action("Categories", "Grid")), "CategoryID", "CategoryName")
33+
.Title("Category").Width(200);
34+
```
35+
36+
## See Also
37+
38+
* [Foreign Key Column Local Binding (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/foreignkeycolumn)
39+
* [Foreign Key Column Remote Binding (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/foreignkeycolumnbinding)
40+
* [Server-Side API](/api/grid)

docs/accessibility/keyboard-support.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ In addition to the `accesskey` attribute support, most Kendo UI widgets also off
2727
- [AutoComplete](https://demos.telerik.com/kendo-ui/autocomplete/keyboard-navigation)
2828
- [Breadcrumb](https://demos.telerik.com/kendo-ui/breadcrumb/keyboard-navigation)
2929
- [Button](https://demos.telerik.com/kendo-ui/button/keyboard-navigation)
30-
- [Button](https://demos.telerik.com/kendo-ui/button/keyboard-navigation)
3130
- [ButtonGroup](https://demos.telerik.com/kendo-ui/buttongroup/keyboard-navigation)
3231
- [Calendar](https://demos.telerik.com/kendo-ui/calendar/keyboard-navigation)
3332
- [ColorPicker](https://demos.telerik.com/kendo-ui/colorpicker/keyboard-navigation)
@@ -40,9 +39,10 @@ In addition to the `accesskey` attribute support, most Kendo UI widgets also off
4039
- [DropDownList](https://demos.telerik.com/kendo-ui/dropdownlist/keyboard-navigation)
4140
- [DropDownTree](https://demos.telerik.com/kendo-ui/dropdowntree/keyboard-navigation)
4241
- [Editor](https://demos.telerik.com/kendo-ui/editor/keyboard-navigation)
42+
- [FileManager](https://demos.telerik.com/kendo-ui/filemanager/keyboard-navigation)
4343
- [Gantt](https://demos.telerik.com/kendo-ui/gantt/keyboard-navigation)
4444
- [Grid](https://demos.telerik.com/kendo-ui/grid/keyboard-navigation)
45-
- [ListBox](https://demos.telerik.com/kendo-ui/listview/keyboard-navigation)
45+
- [ListBox](https://demos.telerik.com/kendo-ui/listbox/keyboard-navigation)
4646
- [ListView](https://demos.telerik.com/kendo-ui/listview/keyboard-navigation)
4747
- [MediaPlayer](https://demos.telerik.com/kendo-ui/mediaplayer/keyboard-navigation)
4848
- [Menu](https://demos.telerik.com/kendo-ui/menu/keyboard-navigation)
@@ -51,9 +51,13 @@ In addition to the `accesskey` attribute support, most Kendo UI widgets also off
5151
- [MultiViewCalendar](https://demos.telerik.com/kendo-ui/multiviewcalendar/keyboard-navigation)
5252
- [NumericTextBox](https://demos.telerik.com/kendo-ui/numerictextbox/keyboard-navigation)
5353
- [PanelBar](https://demos.telerik.com/kendo-ui/panelbar/keyboard-navigation)
54+
- [PDFViewer](https://demos.telerik.com/kendo-ui/pdfviewer/keyboard-navigation)
55+
- [Rating](https://demos.telerik.com/kendo-ui/rating/keyboard-navigation)
5456
- [Scheduler](https://demos.telerik.com/kendo-ui/scheduler/selection)
5557
- [Slider](https://demos.telerik.com/kendo-ui/slider/keyboard-navigation)
5658
- [Splitter](https://demos.telerik.com/kendo-ui/splitter/keyboard-navigation)
59+
- [Spreadsheet](https://demos.telerik.com/kendo-ui/spreadsheet/keyboard-navigation)
60+
- [Stepper](https://demos.telerik.com/kendo-ui/stepper/keyboard-navigation)
5761
- [Switch](https://demos.telerik.com/kendo-ui/switch/keyboard-navigation)
5862
- [TabStrip](https://demos.telerik.com/kendo-ui/tabstrip/keyboard-navigation)
5963
- [TimePicker](https://demos.telerik.com/kendo-ui/timepicker/keyboard-navigation)

docs/api/javascript/ui/grid.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,21 @@ The JavaScript function executed on initialization of the row which will determi
664664
});
665665
</script>
666666

667+
### columns.dataSource `Object|kendo.data.DataSource`
668+
669+
The data source of the values for the foreign key columns. Can be a JavaScript object which represents a valid data source configuration or an existing [kendo.data.DataSource](/api/javascript/data/datasource)
670+
instance.
671+
672+
> **Note:** When the dataSource property is set one should also set the [dataTextField](columns.dataTextField) and [dataValueField](columns.dataValueField).
673+
674+
### columns.dataTextField `String`
675+
676+
The data text field of the foreign key item.
677+
678+
### columns.dataValueField `String`
679+
680+
The data value field of the foreign key item.
681+
667682
### columns.editable `Function`
668683

669684
The JavaScript function executed when the cell/row is about to be opened for edit. The result returned will determine whether an editor for the column will be created.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: ForeignKey Column
3+
page_title: jQuery Grid Documentation | ForeignKey Column | Kendo UI
4+
description: "Get started with the jQuery Grid by Kendo UI and learn how to set up the ForeignKey column."
5+
slug: foreignkeycolumn_kendoui_grid_widget
6+
position: 9
7+
---
8+
9+
# ForeignKey Column
10+
11+
The ForeignKey column functionality of the Kendo UI Grid is primarily used for matching the value of a bound property to a desired text field from an external for the grid collection. It follows the convention of the SQL ForeignKey functionality that is used for linking two tables based on a foreign key.
12+
13+
The foreign values for the columns of the grid could be supplied in two ways:
14+
15+
* [Binding to a local collection](#binding-to-a-local-collection)
16+
* [Binding to a remote collection](#binding-to-a-remote-collection)
17+
18+
## Binding to a Local Collection
19+
20+
Binding the column to a local collection of items can be done via the [column.values](/api/javascript/ui/grid/configuration/columns.values) option.
21+
22+
```
23+
<div id="grid"></div>
24+
<script>
25+
$("#grid").kendoGrid({
26+
columns: [
27+
{ field: "productName" },
28+
{ field: "category", values: [
29+
{ text: "Beverages", value: 1 },
30+
{ text: "Food", value: 2 }
31+
] }
32+
],
33+
dataSource: [
34+
{ productName: "Tea", category: 1 },
35+
{ productName: "Ham", category: 2 }
36+
]
37+
});
38+
</script>
39+
```
40+
41+
## Binding to a Remote Collection
42+
43+
In order to bind the column to a remote collection of items, supply the [column.dataSource](/api/javascript/ui/grid/configuration/columns.dataSource) option. It is mandatory to supply the [columns.dataValueField](/api/javascript/ui/grid/configuration/columns.dataValueField) and [columns.dataTextField](/api/javascript/ui/grid/configuration/columns.dataTextField) options in order to ensure that the column values will be bound to the correct foreign value.
44+
45+
```
46+
columns:[{
47+
field: "CategoryID",
48+
width: "200px",
49+
dataTextField: "CategoryName",
50+
dataValueField: "CategoryID",
51+
dataSource: {
52+
type: "odata",
53+
transport: {
54+
read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"
55+
}
56+
},
57+
title: "Category"
58+
}]
59+
```
60+
61+
62+
## See Also
63+
64+
* [Foreign Key Column Local Binding (Demo)](https://demos.telerik.com/kendo-ui/grid/foreignkeycolumn)
65+
* [Foreign Key Column Remote Binding (Demo)](https://demos.telerik.com/kendo-ui/grid/foreignkeycolumnbinding)
66+
* [JavaScript API Reference of the Grid](/api/javascript/ui/grid)
67+
* [Kendo UI Knowledge Base](/knowledge-base)

0 commit comments

Comments
 (0)