我希望 Wijmo FlexGrid列宽应该覆盖整个宽度。
因为我动态分配列所以不能使用[width]="'*'"
将模板引用变量分配给网格。例如flex1
<wj-flex-grid #flex1
[itemsSource]="data">
<wj-flex-grid>
然后在ngAfterViewInit
回调中设置您的列并为有问题的列分配宽度'*'
,例如
import { Component, ViewChild, AfterViewInit } from '@angular/core';
import { Collection } from 'wijmo/wijmo';
import { FlexGrid } from 'wijmo/wijmo.grid';
@Component({ ... })
export class MyComponent implements AfterViewInit {
@ViewChild('flex1') protected grid: FlexGrid;
protected data: any;
constructor() {
this.data = new Collection([
{ id: 1, country: 'United States' },
{ id: 2, country: 'Germany' },
]);
}
public ngAfterViewInit() {
// Missing part: Set up columns programmatically
// OP has done this already.
// Set the column width of the column with binding to the `country` property
this.grid.columns.getColumn('country').width = '*';
}
}