psi_mmobile

Untitled

Oct 22nd, 2025
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. edit-obs.component.ts
  2. // after line 226 this.finishRequest(resolve); });
  3.  
  4. change.children?.forEach((childNode) => {
  5. this.recursivePut(childNode, resolve);
  6. });
  7.  
  8.  
  9.  
  10. recursivePut(node, resolve) {
  11. if(node.children?.length > 0) {
  12. node.children.forEach((child) => {
  13. this.obsService.updateObsData(child.data).then(() => {
  14. this.finishRequest(resolve);
  15. });
  16. this.recursivePut(node, resolve);
  17. })
  18. }
  19. }
  20.  
  21.  
  22.  
  23. // tree grid
  24.  
  25. search: true,
  26. rowReorder : {
  27. showGrip : true
  28. }
  29.  
  30. this.grid.addListener({
  31. gridRowDrag : ({context}) => {
  32. let movedNode = context.records[0];
  33. movedNode.data.obs_level = context.parent.data.obs_level + 1;
  34. movedNode.data.parent_obs_id = context.parent.data.obs_id;
  35. this.recursiveLevelUpdate(movedNode);
  36. }
  37. });
  38.  
  39.  
  40. recursiveLevelUpdate(node) {
  41. if(node.children?.length > 0) {
  42. node.children.forEach((child) => {
  43. child.obs_level = +node.obs_level + 1;
  44. this.recursiveLevelUpdate(child);
  45. })
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment