Changing 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

    Here is the jsfiddle not working when I try to add the Save method to the Model

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

    Posted 24 Oct 2013 Link to this post


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

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