我正在使用泳道的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
属性的默认值为100
。IMHO,如果我们尝试定义width
值小于100
,那么我们也需要定义minWidth
属性。
minWidth:数量
列的最小宽度,以像素为单位。默认值:100