本帖最后由 CSCWijmo 于 2017-12-12 10:48 编辑
通过继承的方式去继承了 WjFlexGridColumn ,但是发现列表数据都为空
- import { Component, ElementRef, Injector, forwardRef, Inject, SkipSelf, Optional, EventEmitter, ChangeDetectorRef } from '@angular/core';
- import { Validator, AbstractControl, ValidationErrors, NG_VALIDATORS } from '@angular/forms';
- import { WjFlexGridColumn, wjFlexGridColumnMeta } from 'wijmo/wijmo.angular2.grid';
- import { FlexGrid } from 'wijmo/wijmo.grid';
- import { FlexGridXlsxConverter } from 'wijmo/wijmo.grid.xlsx';
- import * as wjcCore from 'wijmo/wijmo';
- import * as wjcXlsx from 'wijmo/wijmo.xlsx';
- import * as wjcGridXlsx from 'wijmo/wijmo.grid.xlsx';
- import * as wjcGrid from 'wijmo/wijmo.grid';
- @Component({
- selector: 'csc-flex-grid-column',
- template: wjFlexGridColumnMeta.template,
- inputs: [...wjFlexGridColumnMeta.inputs],
- outputs: [...wjFlexGridColumnMeta.outputs],
- providers: [
- { provide: 'WjComponent', useExisting: forwardRef(() => CscFlexGridColumn) },
- ...wjFlexGridColumnMeta.providers
- ]
- })
- export class CscFlexGridColumn extends WjFlexGridColumn {
- constructor( @Inject(ElementRef) elRef: ElementRef,
- @Inject(Injector) injector: Injector,
- @Inject('WjComponent') @SkipSelf() @Optional() parentCmp: any) {
- super(elRef, injector, parentCmp);
- }
- ngOnInit() {
- }
- }
复制代码
下面的代码是原来的代码,运行是正常的
- <wj-flex-grid [itemsSource]="columnHeadLists" [isReadOnly]="true" (selectionChanged)="getCurrentItem()" #flexGrid>
- <wj-flex-grid-column *ngIf="true" [header]="'xxx'" [binding]="'ICINAM'" [width]="'*'" [align]="'left'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'USRNAM'" [width]="'*'" [align]="'left'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'USRNBR'" [width]="'*'" [align]="'left'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'GODAMT'" [width]="'*'" [align]="'right'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'FEEAMT'" [width]="'*'" [align]="'right'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'CVTAMT'" [width]="260" [align]="'right'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'RMKRMK'" [width]="'*'" [align]="'left'"></wj-flex-grid-column>
- <wj-flex-grid-column [header]="'xxx'" [binding]="'OPRDAT'" [width]="'*'" [align]="'left'"></wj-flex-grid-column>
- </wj-flex-grid>
复制代码
但是将 <wj-flex-grid-column> 改成 <csc-flex-grid-column> 就列表完全没显示内容了
- <wj-flex-grid [itemsSource]="columnHeadLists" [isReadOnly]="true" (selectionChanged)="getCurrentItem()" #flexGrid>
- <csc-flex-grid-column *ngIf="true" [header]="'xxx'" [binding]="'ICINAM'" [width]="'*'" [align]="'left'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'USRNAM'" [width]="'*'" [align]="'left'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'USRNBR'" [width]="'*'" [align]="'left'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'GODAMT'" [width]="'*'" [align]="'right'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'FEEAMT'" [width]="'*'" [align]="'right'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'CVTAMT'" [width]="260" [align]="'right'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'RMKRMK'" [width]="'*'" [align]="'left'"></csc-flex-grid-column>
- <csc-flex-grid-column [header]="'xxx'" [binding]="'OPRDAT'" [width]="'*'" [align]="'left'"></csc-flex-grid-column>
- </wj-flex-grid>
复制代码
结果如下:
有数据的行数,但是列表头和数据内容都没展示
|