Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom props to tree node #1580

Closed
hsbalar opened this issue Jun 1, 2018 · 9 comments
Closed

Add Custom props to tree node #1580

hsbalar opened this issue Jun 1, 2018 · 9 comments
Assignees
Labels

Comments

@hsbalar
Copy link

hsbalar commented Jun 1, 2018

What problem does this feature solve?

Can we have feature that node can contains more information other than title, key, isLeaf etc

What does the proposed API look like?

have different icon based on json,
can display more information instead only title,
can have html template

@vthinkxie
Copy link
Member

@hsbalar
Copy link
Author

hsbalar commented Jun 1, 2018

@vthinkxie I mean to say can we add custom props to each node of tree, Accept title, key etc Like below json, what if I have more information to show.
Thanks

  nodes = [
    new NzTreeNode({
      title   : 'root1',
      key     : '1001',
      type    : 'a',
      test    : '',
      data    : {
        map : '',
        name: 'xyz',
        status: 'suspended'
      }
      expanded: true,
      children: [
        {
          title   : 'child1',
          key     : '10001',
          type    : 'a',
          test    : '',
          data    : {
            map : '',
            name: 'xyz',
            status: 'suspended'
          }
          children: [
            {
              title   : 'child1.1',
              key     : '100011',
              selected: true,
              type    : 'a',
              test    : '',
              data    : {
                map : '',
                name: 'xyz',
                status: 'suspended'
              }
              children: []
            }
          ]
        }
      ]
    })
  ];

@vthinkxie
Copy link
Member

@hsbalar it is very easy to custom your own tree using template, it can transform any json to the template you want.

@hsbalar
Copy link
Author

hsbalar commented Jun 1, 2018

I'm not able to provide custom JSON, when Initialising tree.
Like type, status. I want to pass some more data to tree.

nodes = [
    new NzTreeNode({
      title   : 'root1',
      key     : '1001',
      type    : 'a',
      status  :''
  })
];

@vthinkxie
Copy link
Member

@simplejason

@vthinkxie vthinkxie reopened this Jun 1, 2018
@vthinkxie
Copy link
Member

@hsbalar https://stackblitz.com/edit/angular-d3ury1?file=app/app.component.ts
you can use this as temp solution, there are some typescript definition lost in our interface,
thanks for your feedback, we will fix it in next version.

@hsbalar
Copy link
Author

hsbalar commented Jun 1, 2018

Your welcome @vthinkxie.

@simplejason
Copy link
Member

#1584

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants