Browse Source

UI Improvement: added argument updatedData in function updateNode in nav-tree component

pull/5485/head
Vladyslav_Prykhodko 5 years ago
parent
commit
2a9b28ddc3
  1. 7
      ui-ngx/src/app/shared/components/nav-tree.component.ts

7
ui-ngx/src/app/shared/components/nav-tree.component.ts

@ -42,7 +42,7 @@ export interface NavTreeEditCallbacks {
nodeIsOpen?: (id: string) => boolean;
nodeIsLoaded?: (id: string) => boolean;
refreshNode?: (id: string) => void;
updateNode?: (id: string, newName: string) => void;
updateNode?: (id: string, newName: string, updatedData?: any) => void;
createNode?: (parentId: string, node: NavTreeNode, pos: number | string) => void;
deleteNode?: (id: string) => void;
disableNode?: (id: string) => void;
@ -221,11 +221,14 @@ export class NavTreeComponent implements OnInit {
}
}
};
this.editCallbacks.updateNode = (id, newName) => {
this.editCallbacks.updateNode = (id, newName, updatedData) => {
const node: NavTreeNode = this.treeElement.jstree('get_node', id);
if (node) {
this.treeElement.jstree('rename_node', node, newName);
}
if (updatedData && node.data) {
Object.assign(node.data, updatedData);
}
};
this.editCallbacks.createNode = (parentId, node, pos) => {
const parentNode: NavTreeNode = this.treeElement.jstree('get_node', parentId);

Loading…
Cancel
Save