Changing kendo.data.Model After It's been Defined

2 posts, 0 answers
  1. Long
    Long avatar
    5 posts
    Member since:
    Sep 2013

    Posted 23 Oct 2013 Link to this post

    Is there a way to add methods to a Model's definition after it's already been defined?

    I have a Product Model that is reused throughout my application. There a form when which I bind to this Product model in my app that needs a few extra methods on it so for the "Save" button using MVVM. However I don't want to add this to the Product Model definition because this particular form is the only one that needs the "Save" method.

    Here is the jsfiddle working, without adding the Save function to the Model
    http://jsfiddle.net/lelong37/RvsCg/1/

    Here is the jsfiddle not working when I try to add the Save method to the Model
    http://jsfiddle.net/lelong37/t8Bq2/3/

    Your help is greatly appreciated.
  2. Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 24 Oct 2013 Link to this post

    Hello,

    You should pass a plain object to the extend method and use the extended model to initialize the instance. Check this updated jsFiddle.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top