Polymorphism in Grid

5 posts, 0 answers
  1. Thomas
    Thomas avatar
    2 posts
    Member since:
    Dec 2013

    Posted 14 Jan 2014 Link to this post

    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
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 16 Jan 2014 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Thomas
    Thomas avatar
    2 posts
    Member since:
    Dec 2013

    Posted 19 Jan 2014 Link to this post

    Hi Vladimir,
    ok, thanks for the answer.

    Regards,
    Thomas
  5. Morten
    Morten avatar
    6 posts
    Member since:
    Mar 2015

    Posted 16 Oct 2015 in reply to Vladimir Iliev Link to this post

    Any chance this has changed? If not do you have an example or some hints on how to do this?
  6. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 20 Oct 2015 Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready