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

    Qtree Defatult Expand All Doesn't work?

    Help
    2
    3
    830
    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
      mecjos last edited by

      Hi. Here is my code. It’s very simple? Where is my wrong?

      <q-tree :nodes="assemblies" label-key="name" node-key="id" default-expand-all :selected.sync="selectedAssembly" selected-color="primary"/>
      

      I fetch the nodes from laravel kelnoy/nest… It doesn’t expand as default.

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @mecjos last edited by dobbel

        @mecjos

        as you can see the ‘default’ q-tree auto expand is not broken:

        https://quasar.dev/vue-components/tree#Example--Customizing-nodes

        If you look at the api desciption of default-expand-all :

        Allow the tree to have all its branches expanded, when first rendered

        So auto expand will only work when the q-tree is first rendered.

        So it will not work if you’re fetching the nodes and change the nodes after the q-tree has first rendered. Instead you should call expandAll() on the q-tree ( using a ‘ref’) after you have populated the tree with your fetched data.

        1 Reply Last reply Reply Quote 1
        • M
          mecjos last edited by

          @dobbel thank you… I added it into updated lifecycle hook and it’s ok…

            updated () {
              this.$refs.asmTree.expandAll()
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post