我将 ngx-datatable 的列宽度存储在数据库中。我使用 AJAX 调用获取这些值。
如何为数据表设置这些值?
我尝试过的:
- 设置 [width] 属性
<ngx-datatable-column>
element
- 将数据表注入为
@ViewChild(DatatableComponent) table: DatatableComponent;
和设置this.table.bodyComponent.columns[0].width = 500;
我尝试过这些方法,有或没有this.table.recalculate();
,但似乎没有任何作用。
EDIT
我在用着datatable-column
with header-template
and cell-template
.
如果您使用以下解决方案黄德阮 https://stackoverflow.com/a/48229976/3099191,您还可以将宽度存储在列中:
columns = [
{ name: 'Name', prop: 'name', width: 250},
{ name: 'Gender', prop: 'gender'},
{ name: 'Company', prop: 'company', sortable: false }
];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)