我正在使用priming treetable,但在下面的代码中,展开/折叠图标不可见,
https://www.primefaces.org/primeng/#/treetable
我不知道是不是rownode的问题,
我只获取父数据,子数据不可见,因为折叠/展开图标不可见

 <p-treeTable [value]="files2">
    <ng-template pTemplate="header">
        <tr>
            <th>Name</th>
            <th>Size</th>
            <th>Type</th>
        </tr>
    </ng-template>
    <ng-template pTemplate="body" let-rowNode let-rowData="rowData" let-expanded="expanded" >
        <tr>
            <td (click)="toggle()" >
                 <p-treeTableToggler [rowNode]="rowNode" ></p-treeTableToggler>
                {{rowData.name}}
            </td>
            <td>{{rowData.size}}</td>
            <td>{{rowData.type}}</td>
        </tr>
    </ng-template>
</p-treeTable>

TS文件
     this.files2=[
        {
            "data":{
                "name":"Applications",
                "size":"200mb",
                "type":"Folder"
            },
            "children":[
                {
                    "data":{
                        "name":"Angular",
                        "size":"25mb",
                        "type":"Folder"
                    },
                    "children":[
                        {
                            "data":{
                                "name":"angular.app",
                                "size":"10mb",
                                "type":"Application"
                            }
                        },
                        {
                            "data":{
                                "name":"cli.app",
                                "size":"10mb",
                                "type":"Application"
                            }
                        },
                        {
                            "data":{
                                "name":"mobile.app",
                                "size":"5mb",
                                "type":"Application"
                            }
                        }
                    ]
                },
                {
                    "data":{
                        "name":"editor.app",
                        "size":"25mb",
                        "type":"Application"
                    }
                },
                {
                    "data":{
                        "name":"settings.app",
                        "size":"50mb",
                        "type":"Application"
                    }
                }
            ]
        }
]

在这里我只得到父母的价值观,我没有得到孩子的价值观

最佳答案

使用的是三元底漆,因此在使用前需要安装

npm install primeicons --save

<link rel="stylesheet" type="text/css" href="/node_modules/primeicons/primeicons.css" />

有关详细信息,请参阅此处的启动指南-
https://www.primefaces.org/primeng/#/setup

关于angular - Primeng TreeTable图标不可见,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51016770/

10-10 21:54