observable does not obtain property defined on array

2 posts, 0 answers
  1. Robert
    Robert avatar
    2 posts
    Member since:
    Nov 2007

    Posted 05 May 2015 Link to this post

    Create an array.  Add a non numeric property to it with a value.  Assign that array to an object as a property.  Create an observable of that object.  The array no longer has its non numeric property.  How can this be avoided?  The same test with an object (which is all an array is) works fine.  



    The first half of that fiddle shows the object case which works.  The second half shows the array case which does not.  




  2. Rosen
    Rosen avatar
    3253 posts

    Posted 07 May 2015 Link to this post

    Hello Robert,

    I'm afraid that this is by design behavior of the ObservableArray. As you know when converted into an observable object, the values of the Array will be used for constructing the ObservableArray instance. This means that custom fields defined on the original Array instance will not be transferred to the ObservableArray. If you need this field attached to the ObservableArray you will need to attach it manually, however there will be no change tracking available.

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