Automatically copy values from view model to other fields

2 posts, 0 answers
  1. Ansley
    Ansley avatar
    1 posts
    Member since:
    Apr 2013

    Posted 20 May 2013 Link to this post

    I have a viewmodel that binds a strongly typed model to the view's controls:

    Example: <input type="text" placeholder="Address 1" id="CurrentAddress1" data-bind="value: account.CurrentAddress.Address1"> and <input type="text" placeholder="Address 1" id="PermanentAddress1" data-bind="value: account.PermanentAddress.Address1">

    I need functionality, that if a checkbox for "Same As" is checked, the Permanent values in other controls get copied over from the Current values as the user enteres them.

    Seems that I need to override either the dataSource or the model bindings, but as a new Kendo developer I am wondering how this would be possible. THanks!
  2. Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 22 May 2013 Link to this post


    Kendo does not support such copying functionality which you can use. You will need to manually iterate through the properties of the model and copy the values.
    Another approach would be to set the whole nested object with a new one, however this would have slightly different effect.

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