我也在 GitHub 上提到了这个问题,但还没有人回答,所以我想在这里寻求帮助:
我使用带有可调整大小列的 Turbo-Table 并将 [scrollable] 属性设置为 false,并且我的表是在 Microsoft Edge 和 Internet Explorer 11 浏览器(Chrome 和 FireFox 正确处理)上使用不必要的垂直和水平滚动条创建的。有谁知道如何摆脱这些多余的滚动条?
一些环境细节:
PrimeFaces version: 5.2.4 (Also occurs on last version (6-Alpha))
Browsers: Microsoft Edge 42.17134.1.0, Microsoft IE11.0.65 (Works well on Chrome and FireFox)
重现步骤:
构建一个简单的文本数据表,大约 10 行,具有可调整大小的列和 [scrollable]="false"
代码如下:
app.component.html
<p-table [value]="cars" [resizableColumns]="true" [scrollable]="false">
<ng-template pTemplate="header">
<tr>
<th *ngFor="let col of cols" pResizableColumn>
{{col.header}}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-car>
<tr>
<td *ngFor="let col of cols" class="ui-resizable-column">
{{car[col.field]}}
</td>
</tr>
</ng-template>
</p-table>
app.component.ts
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: []
})
export class AppComponent implements OnInit {
constructor() {
}
cars: any[];
cols: any[];
ngOnInit() {
this.cars = [
{vin: '11', year: '1111', brand: 'dddd', color: 'blue', madeIn: 'Japan'},
{vin: '12', year: '1112', brand: 'aaaa', color: 'green', madeIn: 'Germany'},
{vin: '13', year: '1113', brand: 'cccc', color: 'yellow', madeIn: 'Japan'},
{vin: '14', year: '1114', brand: 'dddd', color: 'blue', madeIn: 'Japan'},
{vin: '15', year: '1115', brand: 'aaaa', color: 'green', madeIn: 'Korea'},
{vin: '16', year: '1116', brand: 'cccc', color: 'black', madeIn: 'China'},
{vin: '17', year: '1117', brand: 'dddd', color: 'blue', madeIn: 'USA'},
{vin: '18', year: '1118', brand: 'aaaa', color: 'green', madeIn: 'Japan'},
{vin: '19', year: '1119', brand: 'cccc', color: 'grey', madeIn: 'Germany'},
{vin: '20', year: '1120', brand: 'dddd', color: 'blue', madeIn: 'France'},
];
this.cols = [
{field: 'vin', header: 'Vin'},
{field: 'year', header: 'Year'},
{field: 'brand', header: 'Brand'},
{field: 'color', header: 'Color'},
{field: 'madeIn', header: 'Made In'}
];
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {TableModule} from 'primeng/table';
import {AppComponent} from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
TableModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }