Pending Review
Last Updated: 02 Apr 2019 14:12 by Stephen
Patrick
Created on: 29 Nov 2012 11:36
Category: Data Source
Type: Feature Request
46
Support composite keys in the DataSource ID property
At the moment, the DataSource only uses one field for its ID property (if you enter several, then only one is used, apparently).  This doesn't reflect reality, in that in many cases (where one record is a child of another), the key field for a database table is a composite (from 2 or more fields).  
The existing situation causes problems in inline editing of the KendoUI grid, because default values need to be set for foreign key fields, but if these are set to a valid value, then spurious calls to the Inline_Create method occur because the DataSource treats the record as a new record when it is not.
In any case, allowing multiple fields would simply reflect reality.
4 comments
Stephen
Posted on: 02 Apr 2019 14:12
I am surprised that a professional and enterprise-strength toolset like this product still does not support composite keys after all these years. Let's make it happen! :)
Steve
Posted on: 19 Feb 2018 17:22
I worked around this with a pseudo key as suggested in this post. https://www.telerik.com/forums/composite-datakey-in-kendo-ui-mvc#JlhcEtSyAEqMWaW6TjnDKQ
Patrick
Posted on: 23 Aug 2014 19:45
I have used the following workaround to solve this. 
Usually I have to use buddy or ViewModel classes in the grid, rather than the raw entity framework (or other) classes from the database itself, because the raw classes usually have circular object graphs (because they have parent child relationship fields). 

In the code to create buddy/viewmodel classes from the raw classes, I populate an extra field that I've added to the buddy classes, IDForKendoTemplate, and I give this a unique value (i.e. 1, 2, 3, sequentially) for each object that is converted.  I can then use that field as the ID for kendoUI grids, and to identify parent grids uniquely in templates.
Kevin
Posted on: 15 May 2013 21:53
I ran into this too.  A UI framework shouldn't really force us to have our data stored in a certain way to be effective.