Skip to content

Commit

Permalink
TreeGrid: new data api methods #1714
Browse files Browse the repository at this point in the history
  • Loading branch information
ashklianko authored and alansemenov committed Jan 14, 2021
1 parent b5b4e0f commit 57b8750
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1725,10 +1725,32 @@ export class TreeGrid<DATA extends IDentifiable>
this.grid.selectRow(row, debounce);
}

hasNodeWithDataId(dataId: string): boolean {
hasItemWithDataId(dataId: string): boolean {
return !!this.root.getNodeByDataId(dataId);
}

hasItemWithDataIdInDefault(dataId: string): boolean {
return !!this.root.getNodeByDataIdFromDefault(dataId);
}

getItemWithDataId(dataId: string): DATA {
const node: TreeNode<DATA> = this.root.getNodeByDataId(dataId);

return !!node ? node.getData() : null;
}

getItemWithDataIdFromDefault(dataId: string): DATA {
const node: TreeNode<DATA> = this.root.getNodeByDataIdFromDefault(dataId);

return !!node ? node.getData() : null;
}

getItemWithDataIdFromFiltered(dataId: string): DATA {
const node: TreeNode<DATA> = this.root.getNodeByDataIdFromFiltered(dataId);

return !!node ? node.getData() : null;
}

protected insertDataToParentNode(data: DATA, parent: TreeNode<DATA>, index: number) {
const nodeToInsert: TreeNode<DATA> = this.dataToTreeNode(data, parent);
this.insertNodeToParentNode(nodeToInsert, parent, index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export class TreeRoot<DATA extends IDentifiable> {
return this.getDefaultRoot().findNode(dataId);
}

getNodeByDataIdFromFiltered(dataId: string): TreeNode<DATA> {
return this.getFilteredRoot().findNode(dataId);
}

getNodesByDataId(dataId: string): TreeNode<DATA>[] {
const nodesToUpdate: TreeNode<DATA>[] = [];

Expand Down

0 comments on commit 57b8750

Please sign in to comment.