Hi, Foreign key columns in the grid are not being grouped by text rather by foreign key id. Any recommendations as to how can we group by text of the foreign key col.
Thanks
1 Answer, 1 is accepted
0
Vladimir Iliev
Telerik team
answered on 17 Jul 2013, 09:15 AM
Hi Rick,
Please note that sorting/grouping by the text of the ForeignKeyColumn is not supported out-of-the-box and it will require custom solution. For example you can create hidden column (by adding additional property to the model) which to contain the text representation of the ForeignKeyColumn - please check the example below with additional information:
$(function () {
var grid = $("#grid").data("kendoGrid");
//find the ForeignKeyColumn and replace it's data-field attribute
//to point to the hidden column that contains the text represantation
var menu = grid.thead.find("th[data-field='CategoryID']").attr("data-field", "CategoryName").data("kendoColumnMenu");
menu.field = "CategoryName";
});
Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!