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

    How to i convert the followin array to tree for q-tree components

    Help
    1
    1
    244
    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.
    • syflex
      syflex last edited by

      please i need help on this, I’ve searched for hours and cant find a solution.

      please how do i remove the keys(8,26 and root) and convert it into a tree structure for quasar tree component.

      { “8”: [
      { “id”: 14, “user_id”: 4, “post_id”: 17, “parent_id”: 8, “content”: “ok”,“created_at”: “2018-04-19 08:55:23”,
      “user”: { “id”: 4, “name”: “mentor”}
      },
      { “id”: 55, “user_id”: 4, “post_id”: 17, “parent_id”: 8, “content”: “hello”, “created_at”: “2018-10-28 20:43:25”,
      “user”: { “id”: 4, “name”: “mentor”}
      }
      ],

      “26”: [
      { “id”: 27, “user_id”: 4, “post_id”: 17, “parent_id”: 26, “content”: “goood”, “created_at”: “2018-05-26 10:27:45”,
      “user”: { “id”: 4, “name”: “mentor”}
      },
      { “id”: 56, “user_id”: 4, “post_id”: 17, “parent_id”: 26, “content”: “ok ok ok”, “created_at”: “2018-10-28 20:43:36”,
      “user”: { “id”: 4, “name”: “mentor”}
      },
      { “id”: 57, “user_id”: 4, “post_id”: 17, “parent_id”: 26, “content”: “hhfhsjfdjhffd”, “created_at”: “2018-10-28 20:44:06”,
      “user”: { “id”: 4, “name”: “mentor”}
      }
      ],

      “root”: [
      { “id”: 8, “user_id”: 4, “post_id”: 17, “parent_id”: null, “content”: “hello”,“created_at”: “2018-04-18 17:51:25”,
      “user”: { “id”: 4, “name”: “mentor”}
      },
      { “id”: 26, “user_id”: 4, “post_id”: 17, “parent_id”: null, “content”: “hello”,“created_at”: “2018-05-26 10:27:37”,
      “user”: { “id”: 4, “name”: “mentor” }
      }
      ]
      }

      thanks

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