No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Tree component - use different names for label and children

    Framework
    2
    2
    721
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MarkStacey last edited by

      I’m trying to use the output of d3.nest() to populate my tree - but it appears the tree can only use a property named label and children, rather than the key and values that d3.nest() outputs?
      Is there a simple way to do this?

      1 Reply Last reply Reply Quote 0
      • Shone
        Shone last edited by Shone

        Hi @MarkStacey you can use slots for that.

        <div slot='header-generic' slot-scope='prop' class='row items-center'>
              <span>{{ prop.node.name }}</span>
         </div>
        

        I’ve also created custom filter to search by node.name and by user full name…

        treeFilter (node, filter) {
              const filt = filter.toLowerCase()
              const nodeNameMatch = node.name && node.name.toLowerCase().indexOf(filt) > -1
              const usersMatch = node.users.filter(user => (user.full_name.toLowerCase().indexOf(filt) > -1)).length > 0
        
              return nodeNameMatch || usersMatch
            },
        

        http://quasar-framework.org/components/tree.html#Customizing-nodes-header-and-body-slots

        1 Reply Last reply Reply Quote 0
        • First post
          Last post