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

    [solved] given a leaf in a q-tree, how can I programmatically select a leaf and open all parents?

    Help
    2
    5
    1095
    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.
    • R
      rconstantine last edited by rconstantine

      I’ve been trying to figure out how to use setExpanded to programmatically expand all parent nodes in a q-tree, but I’m stumped.

      I hesitate to show what I’ve tried since nothing even comes close to working.

      Has anyone done this before?

      1 Reply Last reply Reply Quote 0
      • R
        rconstantine last edited by

        I thought I had multiple levels, but I only had two. I discovered the method “getNodeByKey” which is part of q-tree. That’s all I needed to solve my issue. Elsewhere, I am adding a ‘parentID’ to the node as the tree is created and calling the getNodeByKey(ID).parent using the ID of the selected item gets me the parent ID and I can then set it to expanded.

        1 Reply Last reply Reply Quote 0
        • R
          rconstantine last edited by

          BTW, would be nice to add getNodeByKey to the documentation.

          1 Reply Last reply Reply Quote 0
          • M
            Mickey58 last edited by

            @rconstantine - getNodeByKey is documented in https://quasar.dev/vue-components/tree#QTree-API, under the “Methods” tab.

            If you use Mongoose in your backend code, you may want to have a look at this package to more easily manage your tree structures:
            https://www.npmjs.com/package/mongoose-mpath

            I haven’t used it yet together with q-tree, but plan to do so.

            1 Reply Last reply Reply Quote 0
            • R
              rconstantine last edited by

              !!! it was the first one listed in methods! How did I miss it?

              Anyway, I’m using the API from an existing website, so can’t change how anything is served to me. Thanks for the idea though.

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