Skip to content

Commit 6aabba1

Browse files
authored
Merge pull request #4727 from IgniteUI/nalipiev/drag-rowSelect-setters
Check column list in setters for row select and row drag
2 parents ae7fb0b + e69307c commit 6aabba1

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
521521
*/
522522
set rowSelectable(val: boolean) {
523523
this._rowSelection = val;
524-
if (this.gridAPI.grid) {
524+
if (this.gridAPI.grid && this.columnList) {
525525

526526
// should selection persist?
527527
this.allRowsSelected = false;
528528
this.deselectAllRows();
529-
this.resetCachedWidths();
530529
this.calculateGridSizes();
531530
}
532531
}
@@ -545,8 +544,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
545544
*/
546545
set rowDraggable(val: boolean) {
547546
this._rowDrag = val;
548-
if (this.gridAPI.grid) {
549-
this.resetCachedWidths();
547+
if (this.gridAPI.grid && this.columnList) {
550548
this.calculateGridSizes();
551549
}
552550
}

projects/igniteui-angular/src/lib/grids/grid/grid-selection.spec.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { IgxStringFilteringOperand, IgxNumberFilteringOperand } from '../../data
1111
import { configureTestSuite } from '../../test-utils/configure-suite';
1212
import { ScrollsComponent, GridWithPrimaryKeyComponent, SelectionComponent } from '../../test-utils/grid-samples.spec';
1313
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
14+
import { IgxHierarchicalGridMultiLayoutComponent } from '../hierarchical-grid/hierarchical-grid.spec';
15+
import { IgxHierarchicalGridModule } from '../hierarchical-grid/hierarchical-grid.module';
1416

1517
describe('IgxGrid - Row Selection', () => {
1618
configureTestSuite();
@@ -25,11 +27,13 @@ describe('IgxGrid - Row Selection', () => {
2527
ScrollsComponent,
2628
GridSummaryComponent,
2729
GridCancelableComponent,
28-
GridFeaturesComponent
30+
GridFeaturesComponent,
31+
HierarchicalGridRowSelectableIslandComponent
2932
],
3033
imports: [
3134
NoopAnimationsModule,
32-
IgxGridModule
35+
IgxGridModule,
36+
IgxHierarchicalGridModule
3337
]
3438
})
3539
.compileComponents();
@@ -962,6 +966,13 @@ describe('IgxGrid - Row Selection', () => {
962966
expect(rowCheck).toBeDefined();
963967
}));
964968

969+
it('Set rowSelectable on HGrid row island', fakeAsync(() => {
970+
expect(() => {
971+
const fix = TestBed.createComponent(HierarchicalGridRowSelectableIslandComponent);
972+
fix.detectChanges();
973+
}).not.toThrow();
974+
}));
975+
965976
});
966977

967978
@Component({
@@ -1125,3 +1136,21 @@ export class GridFeaturesComponent {
11251136
column.resizable = true;
11261137
}
11271138
}
1139+
1140+
@Component({
1141+
template: `
1142+
<igx-hierarchical-grid #grid1 [data]="data" [autoGenerate]="false" [height]="'400px'" [width]="'500px'" #hierarchicalGrid>
1143+
<igx-column field="ID"></igx-column>
1144+
<igx-column field="ProductName"></igx-column>
1145+
<igx-row-island [key]="'childData'" [autoGenerate]="false" [height]="height" #rowIsland1 [rowSelectable]="true">
1146+
<igx-column field="ID"></igx-column>
1147+
<igx-column field="ProductName"></igx-column>
1148+
</igx-row-island>
1149+
<igx-row-island [key]="'childData2'" [autoGenerate]="false" [height]="height" #rowIsland2 [rowSelectable]="true">
1150+
<igx-column field="Col1"></igx-column>
1151+
<igx-column field="Col2"></igx-column>
1152+
<igx-column field="Col3"></igx-column>
1153+
</igx-row-island>
1154+
</igx-hierarchical-grid>`
1155+
})
1156+
export class HierarchicalGridRowSelectableIslandComponent extends IgxHierarchicalGridMultiLayoutComponent { }

0 commit comments

Comments
 (0)