This is a migrated thread and some comments may be shown as answers.

ID with multiple fields

3 Answers 1333 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 20 Dec 2012, 07:38 PM
I have a database table that has a primary key made up of multiple columns. Is there a way for a grid to support this? I am using a WCF Data Service for the data. So ideally I would like to take advantage of the odata support. I can create the URL myself for the operations, microsoft does support multiple keys when doing a put or delete. Or is there a way to use the grid without a model? I was having issues with adding/editing data when I didn't use a model. If I don't have an id field on the model the grid seems to get confused about which models are new and tries creating all of them again.

Thanks,
Chris

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Dec 2012, 02:29 PM
Hello Chris,

I am afraid that the Kendo UI datasource currently does not support composite keys. You should address this on the server, for example if you are using MVC, create a ViewModel, which has a single key field.

Grid editing requires a model and an ID definition:

http://docs.kendoui.com/getting-started/web/grid/editing

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gal
Top achievements
Rank 2
answered on 03 Jun 2015, 06:40 AM

Hi I see there is no solution yet for this issue and I solved it on the client using the parse: 

 

parse: function (response) {
                       for (var i = 0; i < response.Data.length; i++) {
                           response.Data[i].id = "" + response.Data[i].TenentID + response.Data[i].OrderNumber + response.Data[i].Activity;
                           
                       }
                       return response;
                   }

0
Steve
Top achievements
Rank 1
answered on 19 Feb 2018, 04:25 PM

I used a pseudo key as suggested here: https://www.telerik.com/forums/composite-datakey-in-kendo-ui-mvc#JlhcEtSyAEqMWaW6TjnDKQ

 

Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Gal
Top achievements
Rank 2
Steve
Top achievements
Rank 1
Share this question
or