【发布时间】:2021-07-26 11:05:59
【问题描述】:
我正在使用 swimlane 的 ngx-datatable。我需要为表格中的几列指定特定的宽度,但它不起作用。这就是我创建表的方式:
page.component.html:
<ngx-datatable [rows]="rows" [columns]="columns" rowHeight="auto" columnMode="force" [reorderable]="false" [swapColumns]="false"></ngx-datatable>
page.component.ts:
this.columns = [
{ prop: 'col1', resizeable: false, sortable: false, width: 30 },
{ prop: 'col2', resizeable: false },
{ prop: 'col3', resizeable: false, sortable: false },
{ prop: 'col4', resizeable: false, sortable: false },
{ prop: 'col5', resizeable: false, sortable: false, width: 30 }
];
【问题讨论】:
-
您也可以尝试添加这些属性吗?
minWidth: 30, maxWidth: 30 -
@Akif 成功了!为什么它起作用了? :D
-
天意...
标签: angular typescript ngx-datatable