How to use post(update) of data having child objects in them

↘锁芯ラ 提交于 2019-12-12 06:09:00

问题


My data looks something like this.

 "Name":"name16",

  "Description":"Sampledatatest",

  "Remarks":"testat759",

  "ApprovalStatus":"Waiting",

  "Curve":

  [

   {"SLength":185,"StrokeVolume":200,ParentId: 0},

   {"SLength":185,"StrokeVolume":200,ParentId: 0},

   {"SLength":185,"StrokeVolume":200,ParentId: 0},

   {"SLength":185,"StrokeVolume":200,ParentId: 0}

   ]

And this is my update function

function updatep(e) {
      

        var Data = {
            PId: e.model.PId != "" && e.model.PId > 0 ? e.model.PId : 0,
            Name: e.model.Name,
            Description: e.model.Description,
            Remarks: e.model.Remarks,
            Tag: e.model.Tag,
            ApprovalStatus: e.model.ApprovalStatus,
           // Curve: [{SLength:e.model.Curve[0].SLength,SVolume:e.model.Curve[0].SVolume}]
           
        }
        console.log(Data);
        ciSetUp.setPayLoad({ Info: Data });
        ciSetUp.postdata(e.model.Id).then(function () {
            console.log("2"+ciSetUp.postcreatedata);
        });
        
    }

Curve is something that opens on a button click event

when I edit something in curve and want to post using same update function along with other fields like Name,description and Tag, what is the code to do that

来源:https://stackoverflow.com/questions/44716489/how-to-use-postupdate-of-data-having-child-objects-in-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!