Hello everyone,
I have a dynamic Kendo grid that can perform CRUD operations. Foreign Keys are retrieved and mapped to their value and placed in the grid as a drop down list using an editor template, similar to this example here: https://demos.telerik.com/kendo-ui/grid/foreignkeycolumn
I have virtualization enabled on those FK dropdowns similar to this example: https://demos.telerik.com/kendo-ui/dropdownlist/virtualization and my dropdown correctly calls the valueMapper with the id. The problem is with the valueMapper, as this function only receives the FK id or dataitem. I am not able to communicate to the server which column the FK id belongs to, and thus can not return the index of the value. This problem seems that it could result in any grid that has multiple foreign keys so I am hoping there is a solution but I have been unable to find one. Any tips/leads would be greatly appreciated!
Here is my DynamicForeignKey editor template that is used as in each FK column of the grid.
@(
Html.Kendo().DropDownListFor(m => m)
.Filter(FilterType.Contains)
.HtmlAttributes(
new
{ style =
"width:300px"
})
.Height(290)
.DataValueField(
"ForeignKeyID"
)
.DataTextField(
"ForeignKeyName"
)
.DataSource(source =>
{
source.Custom()
.ServerFiltering(
true
)
.ServerPaging(
true
)
.PageSize(80)
.Type(
"aspnetmvc-ajax"
)
.Transport(transport =>
{
transport.Read(
"Read"
,
"ForeignKey"
,
new
{ SchemaName = ViewData[
"SchemaName"
], TableName = ViewData[
"TableName"
], ColumnName = ViewData[
"ColumnName"
] });
});
})
.Virtual(v => v.ItemHeight(26).ValueMapper(
"valueMapper"
))
)