hummingbird-dev / hummingbird-treeview

A powerful and fast jQuery treeview plugin
MIT License
62 stars 23 forks source link

Supporting JSON as data #10

Open armudgal opened 5 years ago

armudgal commented 5 years ago

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.

hummingbird-dev commented 5 years ago

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.

armudgal commented 5 years ago

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