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

Grid Column - Foreign Key Table

5 Answers 257 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 04 Nov 2013, 07:00 PM
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

5 Answers, 1 is accepted

Sort by
0
Ignacio
Top achievements
Rank 1
answered on 04 Nov 2013, 10:07 PM
Are you using the values property to populate this data?
0
Petur Subev
Telerik team
answered on 06 Nov 2013, 01:36 PM
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!
0
Software
Top achievements
Rank 2
answered on 22 May 2014, 03:55 AM
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 
0
Petur Subev
Telerik team
answered on 23 May 2014, 11:51 AM
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!
 
0
Software
Top achievements
Rank 2
answered on 23 May 2014, 06:39 PM
That's understandable.

Thanks for the assist.

//Houdini
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Ignacio
Top achievements
Rank 1
Petur Subev
Telerik team
Software
Top achievements
Rank 2
Share this question
or