Grid Column - Foreign Key Table

6 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Jun 2013

    Posted 04 Nov 2013 Link to this post

    I have a grid that has columns from other tables. When I update the grid with data I loose the data that is referencing the foreign table values. Is there a way to retain these values. The values are not being updated in the grid they are just there for reference.

    Thanks
  2. nikobellic
    nikobellic avatar
    46 posts
    Member since:
    Feb 2013

    Posted 04 Nov 2013 Link to this post

    Are you using the values property to populate this data?
  3. Kendo UI is VS 2017 Ready
  4. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 06 Nov 2013 Link to this post

    Hello Michael,

    It is not getting clear what exactly is the problem that you struggle with, please share with us the code that you have used and where exactly in your code the logic fails (some comments on the problematic lines).

    Basically we have two demos that demonstrate how to edit related key/entities and they do not cause any problems like losing the foreign data.

    http://demos.kendoui.com/web/grid/foreignkeycolumn.html

    http://demos.kendoui.com/web/grid/editing-custom.html


    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Software
    Software avatar
    6 posts
    Member since:
    Aug 2013

    Posted 21 May 2014 in reply to Petur Subev Link to this post

    Hi Petur,

    have you tried grouping on that column?
    Go ahead, head over to http://demos.telerik.com/kendo-ui/web/grid/editing-custom.html enable grouping then try to by group the Category column and see what happens. I have been trying to get pass this bug for the longest time thinking I did something wrong in my code only to realize it is also in your code. Could you instruct me as to how to by this annoyance?

    //Houdini 
  6. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 23 May 2014 Link to this post

    Hello Houdini,

    This is happening because when you group by this column, the datasource does not know how to handle grouping for such complex field, sadly we support grouping only for base properties such as "string", "number", "date" "bool".

    See the difference if you bind the column to the Category.CategoryName field:

    http://trykendoui.telerik.com/@pesho/UJaM

    The updating won't work properly because it will only update the Category.CategoryName filed not the whole Category object. So there is not really universal solution when using nested object, instead I would suggest using the foreignKey column approach. Grouping and updating is working as expected there:

    http://demos.telerik.com/kendo-ui/web/grid/foreignkeycolumn.html

    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. Software
    Software avatar
    6 posts
    Member since:
    Aug 2013

    Posted 23 May 2014 in reply to Petur Subev Link to this post

    That's understandable.

    Thanks for the assist.

    //Houdini
Back to Top
Kendo UI is VS 2017 Ready