locked
Child entity getting removed on ko.push RRS feed

  • Question

  • User-1079190493 posted

    Hi,

     

    I am trying to add a new entity to an existing array in an upshot viewmodel.  The entity is JSON returned from the server and one of its properties is an array.  This part works properly with all related entities mapped

    var promo = {};   
    var promoType = {};
    var promoModel = "Promo:#CodeFirst.Models";
    upshot.map(json[0], promoModel, promo);   
    upshot.addEntityProperties(promo, promoModel);


    However when I push the new upshot entity into the KO array it loses its array of child entities - just an empty array remains with all other properties ok. 

    issue.Promos.push(promo);
    

    has anyone else had this problem or better yet resolved it?

     

    Cheers

    Joe

    Friday, March 30, 2012 11:18 AM

All replies

  • User1364817430 posted

    My experience with adding data is that you have to define your model as a JS Object and make al the properties of the object observable.

    If that doesn't help, I think you will have to provide some more information so I can go and search for the issue.

    greetings

    Kristof

    Friday, April 13, 2012 2:02 AM