Commit 2a9b28ddc313419a78e0c1ff971800d91ba624aa
1 parent
113a6389
UI Improvement: added argument updatedData in function updateNode in nav-tree component
Showing
1 changed file
with
5 additions
and
2 deletions
... | ... | @@ -42,7 +42,7 @@ export interface NavTreeEditCallbacks { |
42 | 42 | nodeIsOpen?: (id: string) => boolean; |
43 | 43 | nodeIsLoaded?: (id: string) => boolean; |
44 | 44 | refreshNode?: (id: string) => void; |
45 | - updateNode?: (id: string, newName: string) => void; | |
45 | + updateNode?: (id: string, newName: string, updatedData?: any) => void; | |
46 | 46 | createNode?: (parentId: string, node: NavTreeNode, pos: number | string) => void; |
47 | 47 | deleteNode?: (id: string) => void; |
48 | 48 | disableNode?: (id: string) => void; |
... | ... | @@ -221,11 +221,14 @@ export class NavTreeComponent implements OnInit { |
221 | 221 | } |
222 | 222 | } |
223 | 223 | }; |
224 | - this.editCallbacks.updateNode = (id, newName) => { | |
224 | + this.editCallbacks.updateNode = (id, newName, updatedData) => { | |
225 | 225 | const node: NavTreeNode = this.treeElement.jstree('get_node', id); |
226 | 226 | if (node) { |
227 | 227 | this.treeElement.jstree('rename_node', node, newName); |
228 | 228 | } |
229 | + if (updatedData && node.data) { | |
230 | + Object.assign(node.data, updatedData); | |
231 | + } | |
229 | 232 | }; |
230 | 233 | this.editCallbacks.createNode = (parentId, node, pos) => { |
231 | 234 | const parentNode: NavTreeNode = this.treeElement.jstree('get_node', parentId); | ... | ... |