File tree Expand file tree Collapse file tree 2 files changed +43
-2
lines changed
Expand file tree Collapse file tree 2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -430,10 +430,18 @@ export class IgGridBase<Model> extends IgControlBase<Model> implements AfterCont
430430
431431 ngAfterContentInit() {
432432 if (this._columns.length) {
433- this._opts["columns"] = this._columns.map((c) => c._settings);
433+ if (this._config) {
434+ this._config["columns"] = this._columns.map((c) => c._settings);
435+ } else {
436+ this._opts["columns"] = this._columns.map((c) => c._settings);
437+ }
434438 }
435439 if (this._features.length) {
436- this._opts["features"] = this._features.map((c) => c.initSettings);
440+ if (this._config) {
441+ this._config["features"] = this._features.map((c) => c.initSettings);
442+ } else {
443+ this._opts["features"] = this._features.map((c) => c.initSettings);
444+ }
437445 }
438446 super.ngOnInit();
439447 }
Original file line number Diff line number Diff line change @@ -329,6 +329,39 @@ export function main() {
329329 }, 10);
330330 });
331331 });
332+
333+ it('should initialize column and feature nested directives with options', (done) => {
334+ var template = "<ig-grid [widgetId]='gridID' [(options)]='opts1'>" +
335+ "<column [key]=\"'Id'\" [(headerText)]=\"idHeaderText\" [width]=\"'165px'\" [dataType]=\"'number'\"></column>" +
336+ "<column [key]=\"'Name'\" [headerText]=\"'Name'\" [width]=\"'250px'\" [dataType]=\"'string'\"></column>" +
337+ "<column [key]=\"'HireDate'\" [headerText]=\"'Quantity per unit'\" [width]=\"'250px'\" [dataType]=\"'date'\"></column>" +
338+ "<feature [name]=\"'Paging'\" [(currentPageIndex)]=\"pi\" [pageSize]=\"'2'\"></feature>" +
339+ "</ig-grid>";
340+ TestBed.overrideComponent(TestComponent, {
341+ set: {
342+ template: template
343+ }
344+ });
345+ TestBed.compileComponents().then(() => {
346+ let fixture = TestBed.createComponent(TestComponent);
347+ fixture.detectChanges();
348+ expect($(fixture.debugElement.nativeElement).find("#grid1_container thead th#grid1_Id").text())
349+ .toBe("Product Id");
350+ expect($(fixture.debugElement.nativeElement).find("#grid1_pager li.ui-state-active").text())
351+ .toBe("2");
352+ fixture.componentInstance.pi = 0;
353+ fixture.componentInstance.idHeaderText = "Changed ID";
354+ setTimeout(() => {
355+ fixture.detectChanges();
356+ //this assert should wait the next Service Release of IgniteUI
357+ //expect($(fixture.debugElement.nativeElement).find("#grid1 thead th#grid1_Id").text())
358+ // .toBe("Changed ID");
359+ expect($(fixture.debugElement.nativeElement).find("#grid1_pager li.ui-state-active").text())
360+ .toBe("1");
361+ done();
362+ }, 10);
363+ });
364+ });
332365 });
333366}
334367
You can’t perform that action at this time.
0 commit comments