Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(grid): set min width to header groups programmatically #3310

Merged
merged 9 commits into from
Dec 7, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
}

/**
* Returns the `IgxGridHeaderGroupComponent`'s minimum allloed width.
* Returns the `IgxGridHeaderGroupComponent`'s minimum allowed width.
* Used internally for restricting header group component width.
* The values below depend on the header cell default right/left padding values.
* @memberof IgxGridBaseComponent
Expand Down Expand Up @@ -2498,7 +2498,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
public getHeaderGroupWidth(column: IgxColumnComponent): string {

const minWidth = this.defaultHeaderGroupMinWidth;
if (parseInt(column.width, 10) < this.defaultHeaderGroupMinWidth) {
if (parseInt(column.width, 10) < minWidth) {
return minWidth.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('IgxGrid - Deferred Column Resizing', () => {
configureTestSuite();
const COLUMN_HEADER_CLASS = '.igx-grid__th';
const COLUMN_HEADER_GROUP_CLASS = '.igx-grid__thead-item';
const COLUMN_FILTER_CELL_CLASS = 'igx-grid-filtering-cell';
bkulov marked this conversation as resolved.
Show resolved Hide resolved

beforeEach(async(() => {
TestBed.configureTestingModule({
Expand Down Expand Up @@ -727,7 +728,7 @@ describe('IgxGrid - Deferred Column Resizing', () => {

const headers = fixture.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
const headerGroups = fixture.debugElement.queryAll(By.css(COLUMN_HEADER_GROUP_CLASS));
const filteringCells = fixture.debugElement.queryAll(By.css('igx-grid-filtering-cell'));
const filteringCells = fixture.debugElement.queryAll(By.css(COLUMN_FILTER_CELL_CLASS ));

expect(headers[0].nativeElement.getBoundingClientRect().width).toBe(49);
expect(headers[1].nativeElement.getBoundingClientRect().width).toBe(50);
Expand All @@ -740,8 +741,6 @@ describe('IgxGrid - Deferred Column Resizing', () => {
expect(headerGroups[0].nativeElement.getBoundingClientRect().width).toBe(48);
expect(headerGroups[1].nativeElement.getBoundingClientRect().width).toBe(50);
expect(headerGroups[2].nativeElement.getBoundingClientRect().width).toBe(48);


}));
});

Expand Down Expand Up @@ -852,7 +851,6 @@ export class NullColumnsComponent implements OnInit {
}
}

bkulov marked this conversation as resolved.
Show resolved Hide resolved

@Component({
template: GridTemplateStrings.declareGrid(`width="400px" height="600px" [allowFiltering]="true"`, ``,
`<igx-column [field]="'Items'" [width]="'40px'" dataType="string" [filterable]="true"></igx-column>
Expand Down