简体   繁体   English

PrimeNG p-table 除了表的名称外不显示任何内容

[英]PrimeNG p-table doesn't show anything but the name of the table

I've updatet PrimeNG from p-dataTable to p-table due to the upgrade of Angular to version 9. I've a table users由于 Angular 升级到版本 9,我已将 PrimeNG 从 p-dataTable 更新为 p-table。我有一个表用户

users = ['one','two','three']

And I want to see them on the screen on rendering of the view, so I have a HTML我想在渲染视图时在屏幕上看到它们,所以我有一个 HTML

 <p-table [value]="users" [scrollable]="true"
                             scrollHeight="45vh">
                    <ng-template pTemplate="caption">Users</ng-template>
                        <div class="row" style="padding-left:80px">
                            <ng-template pTemplate="body">
                                <tr>
                                    <div class="col-sm-4">
                                        <!--ADD USERS-->
                                        <button type="button"
                                                class="btn btn-success btn-sm btn-space center-block custom-font"
                                                (click)="popup.openModal(); popup.refreshTree()">
                                            <span class="glyphicon glyphicon-plus"></span>
                                        </button>
                                    </div>
                                    <div class="col-sm-4">
                                        <!--REMOVE USERS-->
                                        <button type="button"
                                                class="btn btn-danger btn-sm btn-space center-block custom-font"
                                                (click)="popup.deleteList(); popup.refreshTree(); clearIdsArray();">
                                            <span class="glyphicon glyphicon-trash"></span>
                                        </button>
                                    </div>
                                </tr>
                            </ng-template>
                        </div>
                </p-table>

And then the [value] would be updated based on the action in popup mentioned in buttons.然后 [value] 将根据按钮中提到的弹出窗口中的操作进行更新。 The problem is I can not see any button on the screen and have no idea why.问题是我在屏幕上看不到任何按钮,也不知道为什么。 All I see is "Users" nothing more我看到的只是“用户”而已

Try to remove div which includes <ng-template pTemplate="body">尝试删除包含<ng-template pTemplate="body"> div

You can find basic example for templating here .您可以在此处找到模板的基本示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM