How to use post(update) of data having child objec

2019-09-15 05:47发布

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

0条回答
登录 后发表回答