• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

397
Views
ag grid generate path variable dynamically for tree Data

I have a json file in my Angular project with a flat array like so ...

      [
        {
            "id": 1,
            "name": "Demo1",
            "parentId": 0
        },
        {
            "id": 2,
            "name": "Demo2",
            "parentId": 1
        },
        {
            "id": 3,
            "name": "Demo3",
            "start": "24/09/2021 11:00:00",
            "end": "30/09/2021 12:00:00",
            "parentId": 2
        },
        {
            "id": 4,
            "name": "Demo4",
            "start": "24/09/2021 11:00:00",
            "end": "",
            "parentId": 3
        }
     ]

I need to display this data inside Ag Grid with a tree structure. But for Tree structure to work it needs a path property like path: [demo1]; [demo1, demo2]; [demo1, demo2, demo3] I need help with creating the path variable dynamically and adding it back to main array. I can then use this path in the getDataPath function for Ag grid.

this.getDataPath = function (data) {
      return data.path;
    };

You can refer to this link for Ag grid tree data : https://www.ag-grid.com/angular-data-grid/tree-data/

almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error