Ширина столбца Wijmo flexgrid angular2

Я хочу, чтобы Wijmo FlexGrid ширина столбца полностью покрывала ширина.

Поскольку я динамически назначаю столбцы, я не могу использовать [width]="'*'"


person srashtisj    schedule 13.10.2016    source источник


Ответы (1)


Назначьте сетке ссылочную переменную шаблона. Например. 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 = '*';
  }
}
person dotcs    schedule 24.10.2016