我想要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 = '*';
}
}