Retrieving the original object from "observable" wrapper

3 posts, 2 answers
  1. Answer
    Andrew
    Andrew avatar
    3 posts
    Member since:
    Jan 2011

    Posted 25 Nov 2013 Link to this post

    Considering the following data object:

    var obj = {
    person: {
    name: "Holmes"
    address: {
    apt: 221B,
    street: "Baker",
    city: "London"
        }
      }
    }

    And the viewModel built from the above object to be used in a MVVM presentation:
    var viewModel = kendo.observable(obj);
    kendo.bind(..., viewModel)

    After the changes have been done to the viewModel by UI,
    I would like to extract the original object as a whole (rather then field by field)
    with the changes incorporated in it.

    The extracted object would be then sent to another part of the application for processing
    and is expected to have no additional events/functions/types built into it.
    In other words, I would like to detach the "observable" from the object.

    How can I do that?
    Thanks,
    Andrew
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 27 Nov 2013 Link to this post

    Hello Andrew,

    To do that you can use the toJSON method of the observable object.

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Andrew
    Andrew avatar
    3 posts
    Member since:
    Jan 2011

    Posted 29 Nov 2013 Link to this post

    Thanks.
Back to Top