Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

460
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/

about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!