我做了一个固定的标题
<ngx-datatable
[scrollbarV]="true">
但是当我滚动页面时也如何修复摘要行?
<p-dialog
...
<ngx-datatable
...
[scrollbarV]="true"
>
<ngx-datatable-column name="AMOUNT" [summaryTemplate]="totalCost" [flexGrow]="1">
...
</ngx-datatable-column>
...
<ng-template #totalCost>
...
</ng-template>
</p-dialog>
答案 0 :(得分:2)
首先,这里是example,具有固定的多行页脚,包括摘要,这是指向source的链接
同样可以应用于标题,因此您的自定义header-component.ts可能如下所示:
import { Component } from '@angular/core';
@Component({
selector: 'header-demo',
template: `
<ngx-datatable
class="material"
[rows]="rows"
[columns]="columns"
[columnMode]="'force'"
[footerHeight]="50"
[headerHeight]="100"
[rowHeight]="'auto'"
[scrollbarV]="true">
<ngx-datatable-header>
<ng-template
ngx-datatable-header-template
let-rowCount="rowCount"
let-pageSize="pageSize"
let-selectedCount="selectedCount"
let-curPage="curPage"
let-offset="offset">
<div style="padding: 5px 10px">
<div>
<strong>Summary</strong>: Amount
</div>
<hr style="width:100%" />
<div>
Rows: {{rowCount}} |
Size: {{pageSize}} |
Current: {{curPage}} |
Offset: {{offset}}
</div>
</div>
</ng-template>
</ngx-datatable-header>
</ngx-datatable>
`
})
export class HeaderDemoComponent {
rows = [];
columns = [
...
..
.
];
...
..
.
}
如您所见,在您想要实现的任何div构造中完全合法。
提示:利用标题和单元格类声明
在此示例中类似,以实现所需的样式:
<ngx-datatable-column
name="SomeColumn"
[headerClass]="'ngxSomeColumnNameHeader'"
[cellClass]="'ngxSomeColumnNameCell'"
prop="SomeColumnName">
...
..
</ngx-datatable-column>
还可以考虑在如果需要的ngx-datatable标记中使用[columnMode] =“'force'”,[rowHeight] =“'auto'”&[limit] =“ 12”。