页脚标签走出primeng数据表中的水平滚动条

页脚标签走出primeng数据表中的水平滚动条

问题描述:

我使用了角度PrimeNg DataTable,我想在表格中显示页眉和页脚标签。但是页脚没有正确设置。 这里是我的HTML代码:页脚标签走出primeng数据表中的水平滚动条

<p-dataTable [value]="cars" scrollable="true" scrollHeight="200px" scrollWidth="600px" [style]="{'margin-top':'30px'}"> 
 
     <p-header>Vertical and Horizontal</p-header> 
 
     <p-column field="vin" header="Vin" footer="Vin" [style]="{'width':'250px'}"></p-column> 
 
     <p-column field="year" header="Year" footer="Year" [style]="{'width':'250px'}"></p-column> 
 
     <p-column field="brand" header="Brand" footer="Brand" [style]="{'width':'250px'}"></p-column> 
 
     <p-column field="color" header="Color" footer="Color" [style]="{'width':'250px'}"></p-column> 
 
    </p-dataTable>

enter image description here

这种风格添加到您的组件的变通

>>> .ui-datatable-scrollable-footer { 
    overflow: hidden; 
} 

警告:使用>>>不是超好主意,请参见https://angular.io/guide/component-styles#deprecated-deep--and-ng-deep