Delphi Json Treeview Dataset

Asked

Viewed 234 times

1

I haven’t seen anything like it here yet,

No Delphi a select no dataset returns the data to my tree this way:

ID  PARENT      NOME          
1   null        GrandFather1    
2   1           Son1            
4   2           GrandSon1       
5   2           GrandSon2       
3   1           Son2
6   null        GrandFather2           

I’d like to ride my Json, thus:

[
    {
        text: 'GrandFather1',
        href: '#1',
        nodes: [
            {
                text: 'Son1',
                href: '#2',
                nodes: [
                    {
                        text: 'GrandSon1',
                        href: '#4'
                    },
                    {
                        text: 'GrandSon2',
                        href: '#5'
                    }
                ]
            },
            {
                text: 'Son2',
                href: '#3'
            }
        ]
    },
    {
        text: 'GrandFather2',
        href: '#6'
    }
]

I’m gonna use the [https://jonmiles.github.io/bootstrap-treeview/]

I confess I’m getting beat up, I tried to use the resources of System.JSON, but I couldn’t get a logic for it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.