使用Angular和Java在每一行中显示包含子节点的分层列表

时间:2015-10-22 08:15:26

标签: java json angularjs hierarchical-data

我有一个分层列表,如下所示。

 FriendList c = 
 [ 
{
    name:"A", 
    nickname:"a", 
    children:[
        {
            name:"A1", 
            nickname:"a1", 
            children:[] 
        },
        {
            name:"A2", 
            nickname:"a2", 
            children:[ 
                {
                    name:"A21", 
                    nickname:"a21", 
                    children:[] 
                },
                {
                    name:"A22", 
                    nickname:"a22", 
                    children:[] 
                },
                {
                    name:"A23", 
                    nickname:"a23", 
                    children:[ 
                        {
                            name:"A231", 
                            nickname:"a231", 
                            children:[] 
                        }             
                    ]
                }
            ]
        },
        {
            name:"A3", 
            nickname:"a3", 
            children:[] 
        },
        {
            name:"A4", 
            nickname:"a4", 
            children:[ 
                {
                    name:"A41", 
                    nickname:"a41", 
                    children:[] 
                }
            ]
        }
    ] 
}
]

我需要在浏览器上使用Javascript / AngularJS显示此数据,并使用Java以下列方式生成PDF:

  parent_name     parent_nickname      child_name      child_nickname

    A                 a                  A1                 a1
    A                 a                  A2                 a2
    A2                a2                 A21                a21
    A2                a2                 A22                a22
    A2                a2                 A23                a23
    A23               a23                A231               a231
    A                 a                  A3                 a3
    A                 a                  A4                 a4
    A4                a4                 A41                a41

我可以使用

中给出的想法

stack overflow displaying hierarchical list as flat

但它只显示前两列的结构。

0 个答案:

没有答案