0

How fire an event when a "clr-tree-node" finish loading the children of a selected node?

Hi all. Do you know if possible to fire an event when a "clr-tree-node" finish loading the children of a selected node? I need to fire the click event of a previously child node, I have the id saved in my ngrx store.

I'm Using this documentation.

<clr-tree
      [clrLoading]="true"
      [clrLazy]="true" class="tree-wrapper">
      <clr-tree-node
        *clrRecursiveFor="let node of filteredItems; getChildren: getChildren"
        [clrExpandable]="node.expandable"
        [clrExpanded]="isExpanded(node)"
        [attr.data-entity-id]="'node_' + node.nodeId"
      >
        <s1-some-tree-item
          [node]="node"
          [selected]="node.nodeId === selectedItemId"
          (onTreeItemSelected)="selectNode(node)"
        ></s1-some-tree-item>
      </clr-tree-node>
    </clr-tree>

    getChildren = (item: ISomeItem) => {
    let somePromise = someRestEndpoint(item.nodeId);
        return somePromise.then((myResolve: any) =>{
          let tempResult = [];
          if(myResolve)
          {
            tempResult = myResolve.map(y => {
              return 
                {
                  nodeId: y._id,
                  name: y.name,
                  nodeType: SomeEnum.Type1,
                  expandable: false,
                  parent: item,
                  children: []
                };
            });
          }
          this.searchItems = tempResult;
          return tempResult;
        });
    }

0 Answers0