Author Topic: Saving event sample for treegrid batch editing  (Read 371 times)

hyh888

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 128
    • View Profile
Saving event sample for treegrid batch editing
« on: May 17, 2022, 07:00:28 am »
In the code of demo, I didn't find the code for saving envent.Would  you like to provide save event sample code for treegrid batch editing?
When I use saving mothod of common grid, pqGrid send json of all records to server when I changed the topnode. It seems that the item property of json is unnesassary.

Here is the json that pqGrid sent to server:
{"oldList":[{"sn":"ZJL"},{"sn":"SCYYZJ"}],"save":[],
"update":[
{"eachLevel":1,"id":"3"
,"items":[{"eachLevel":2,"id":"5"
,"items":[{"eachLevel":3,"id":"6"
,"items":[{"eachLevel":4,"id":"7"
,"items":[{"eachLevel":5,"id":"8","name":" Planner ","pid":"7","sn":"SCJHY","pq_level":4,"parentId":"7","pq_ri":4,"pq_hidden":false,"pq_ht":35}]
,"name":" Planning Supervisor ","pid":"6","sn":"SCJHZG","pq_level":3,"parentId":"6","pq_ri":3,"pq_hidden":false,"pq_ht":35}]
,"name":" Planning Manager ","pid":"5","sn":"SCJHJL","pq_level":2,"parentId":"5","pq_ri":2,"pq_hidden":false,"pq_ht":35}]
,"name":" Operation Director","pid":"3","sn":"SCYYZJ2","pq_level":1,"parentId":"3","pq_ri":1,"pq_hidden":false,"pq_ht":35,"pq_cellcls":{"sn":"pq-cell-dirty"}}]
,"name":"GM","pid":"0","sn":"ZJL1"}
,{"eachLevel":2,"id":"5"
,"items":[{"eachLevel":3,"id":"6"
,"items":[{"eachLevel":4,"id":"7"
,"items":[{"eachLevel":5,"id":"8","name":"Planner","pid":"7","sn":"SCJHY","pq_level":4,"parentId":"7","pq_ri":4,"pq_hidden":false,"pq_ht":35}]
,"name":"Planning Supervisor","pid":"6","sn":"SCJHZG","pq_level":3,"parentId":"6","pq_ri":3,"pq_hidden":false,"pq_ht":35}]
,"name":"Planning Manager","pid":"5","sn":"SCJHJL","pq_level":2,"parentId":"5","pq_ri":2,"pq_hidden":false,"pq_ht":35}]
,"name":"Operation Director","pid":"3","sn":"SCYYZJ2","parentId":"3"}]
,"delete":[]}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6113
    • View Profile
Re: Saving event sample for treegrid batch editing
« Reply #1 on: May 17, 2022, 11:42:38 pm »
you can iterate over the updateList and remove items property before sending changes to the remote server.

hyh888

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 128
    • View Profile
Re: Saving event sample for treegrid batch editing
« Reply #2 on: May 18, 2022, 07:29:28 am »
It will be better if pqGrid can make it a build-in function, I'm surprised for having to do it manully.