Skip to content

Conversation

@tinayuangao
Copy link
Contributor

No description provided.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 17, 2018
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Feb 17, 2018
@tinayuangao tinayuangao force-pushed the tree branch 3 times, most recently from e9a6a63 to 631397c Compare February 20, 2018 21:25
@tinayuangao tinayuangao merged commit c811731 into angular:tree Feb 21, 2018
@jesben
Copy link

jesben commented Mar 12, 2018

Thanks for the demos.

I'm trying to implement asynchronous data retrieval with http service, I can not make it work. Sub nodes are not added on first click, visible after second click! Please help?

Added setTimeout for illustration

dynamic-database.ts

toggleNode(node: DynamicFlatNode, expand: boolean) {
    const children = this.database.getChildren(node.item);
    const index = this.data.indexOf(node);
    if (!children || index < 0) { // If no children, or cannot find the node, no op
      return;
    }

    // Doesn't work
    setTimeout(() => {
      if (expand) {
        const nodes = children.map(name =>
            new DynamicFlatNode(name, node.level + 1, this.database.isExpandable(name)));
        this.data.splice(index + 1, 0, ...nodes);
      } else {
        this.data.splice(index + 1, children.length);
      }

      // notify the change
      this.dataChange.next(this.data);
    }, 0);
  }

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants