ID with multiple fields

3 posts, 0 answers
  1. Chris
    Chris avatar
    8 posts
    Member since:
    Sep 2012

    Posted 20 Dec 2012 Link to this post

    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
  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 21 Dec 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Gal
    Gal avatar
    48 posts
    Member since:
    Apr 2009

    Posted 03 Jun 2015 in reply to Dimo Link to this post

    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;
                       }

Back to Top