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

Polymorphism in Grid

4 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 14 Jan 2014, 10:49 AM
Hi,
is there a way to use a Kendo Grid with polymorphic items and Popup editing?

I'd like to define a base class BaseViewModel with some common properties and subclasses FirstViewModel and SecondViewModel with more specific properties. The Grid is bound to BaseViewModel, but in the Popup Editor I'd like to edit the subclasses. The controller produces an IEnumerable containing FirstViewModels and SecondViewModels.

I have defined EditorTemplates for FirstViewModel and SecondViewModel but the Model which is passed to when editing is always of type BaseViewModel.
Any suggestions?

Kind regards,
Thomas

4 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 16 Jan 2014, 12:33 PM
HI Thomas,

Basically the required behavior is not supported out of the box and it will require custom code as the PopUp editor template is generated on the server side from the same type as the Grid (the PopUp editor always receives as model empty object of the same type as the Grid). 

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Thomas
Top achievements
Rank 1
answered on 19 Jan 2014, 10:20 AM
Hi Vladimir,
ok, thanks for the answer.

Regards,
Thomas
0
Morten
Top achievements
Rank 1
answered on 16 Oct 2015, 04:30 PM
Any chance this has changed? If not do you have an example or some hints on how to do this?
0
Vladimir Iliev
Telerik team
answered on 20 Oct 2015, 11:08 AM
Hi Morten,

This behavior is still not supported out of the box. 

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Thomas
Top achievements
Rank 1
Morten
Top achievements
Rank 1
Share this question
or