hummingbird-treeview icon indicating copy to clipboard operation
hummingbird-treeview copied to clipboard

Supporting JSON as data

Open armudgal opened this issue 5 years ago • 2 comments

Hi, Thanks for this amazing project. I wanted to know whether there is any feature by which we give the data as a JSON, it will create the treeview. For example:

{
    "name":"tree_view",
    "children":[ {
        "name":"TS2:1",
        "children":[ {
            "name":"TS1:1",
            "children":[ {
                "name": "TS3:1", "children": []
            }
            ,
            {
                "name":"TS4:2",
                "children":[ {
                    "name": "TS6:2", "children": []
                }
                ,
                {
                    "name": "TS5:1", "children": []
                }
                ]
            }
            ]
        }
        ]
    }
    ]
}

One way I can do this is by writing JS to create 'ul' and 'li' elements by traversing this json. But it would be great if this can be added in the project itself.

armudgal avatar Apr 04 '19 07:04 armudgal

Hi, Thanks for the ideas. Yes I absolutely agree that JSON input would be great. At the moment, I already have a converter from the "pseudo" list to real HTML. If you can include JS code for a JSON to HTML or via the "pseudo list" converter I would happily include it. At the moment I have no time, but I put it on my list.

hummingbird-dev avatar Apr 04 '19 10:04 hummingbird-dev

Sure I can work on it. I will send the PR once it's done.

armudgal avatar Apr 04 '19 15:04 armudgal