我希望Wijmo FlexGrid column width应覆盖全宽。
我正在动态分配列,因此无法使用[width]="'*'"
答案 0 :(得分:1)
将template reference variable分配给网格。例如。 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 = '*';
}
}