Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- edit-obs.component.ts
- // after line 226 this.finishRequest(resolve); });
- change.children?.forEach((childNode) => {
- this.recursivePut(childNode, resolve);
- });
- recursivePut(node, resolve) {
- if(node.children?.length > 0) {
- node.children.forEach((child) => {
- this.obsService.updateObsData(child.data).then(() => {
- this.finishRequest(resolve);
- });
- this.recursivePut(node, resolve);
- })
- }
- }
- // tree grid
- search: true,
- rowReorder : {
- showGrip : true
- }
- this.grid.addListener({
- gridRowDrag : ({context}) => {
- let movedNode = context.records[0];
- movedNode.data.obs_level = context.parent.data.obs_level + 1;
- movedNode.data.parent_obs_id = context.parent.data.obs_id;
- this.recursiveLevelUpdate(movedNode);
- }
- });
- recursiveLevelUpdate(node) {
- if(node.children?.length > 0) {
- node.children.forEach((child) => {
- child.obs_level = +node.obs_level + 1;
- this.recursiveLevelUpdate(child);
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment