Skip to content

feat(tree-grid): add cascading row selection #8040 #8772

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

Merged
merged 75 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
db6f321
feat(grid): add new grid rowSelection mode
Jan 11, 2021
2968470
chore(*): added initial multipleCascade selection logic
Jan 21, 2021
0e016ad
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 21, 2021
e9e6bfc
chore(*): fix lint issues
Jan 21, 2021
32d37ef
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 21, 2021
3bd7aab
chore(*): fix should bind selectedRows properly test
Jan 21, 2021
95ad14f
chore(*): fix hierarchical-grid test
Jan 21, 2021
977b5f5
chore(*): fix filtering issues
Jan 21, 2021
674ef86
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
MonikaKirkova Jan 22, 2021
dd98bd7
feat(grid): add test scenarios
MonikaKirkova Jan 22, 2021
d96e716
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 26, 2021
4019aad
Merge branch 'mevtimov/feat-8040' of https://github.com/IgniteUI/igni…
Jan 26, 2021
417dcae
feat(grid): add navigation tests
Jan 26, 2021
99f2d40
chore(*): fix lint issues
Jan 26, 2021
28bfed6
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 26, 2021
a4afd48
feat(grid): add row adding tests
Jan 26, 2021
c9d44ea
feat(grid): add row deleting tests
Jan 27, 2021
18a44f3
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 27, 2021
17b31e6
chore(*): fix merge conflicts
Jan 27, 2021
f90edfb
chore(*): fix multipleCascade selection when add row
Jan 27, 2021
20f7602
chore(*): modify row adding test
Jan 27, 2021
c397269
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 27, 2021
8d86434
chore(*): added filtering tests
Jan 27, 2021
8ffe4e1
chore(*): added batch updating tests
Jan 28, 2021
764b7e5
chore(*): modified batch updating test
Jan 28, 2021
491f958
chore(*): fixed batch updating test
Jan 28, 2021
93e18f5
chore(*): add more filtering tests
Jan 28, 2021
30ab842
chore(*): add more filtering tests
Jan 28, 2021
925e229
chore(*): add filtering+updating test
Jan 28, 2021
16f3f15
chore(*): add additional filtering + updating test
Jan 28, 2021
50cca84
chore(*): fix lint issues
Jan 28, 2021
e41f083
chore(*): fix filtering + updating tests
Jan 28, 2021
bdb6476
chore(*): fixed loadOnDemand when multipleCascade selection is enabled
Jan 29, 2021
f4ed64a
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Jan 29, 2021
7267a88
chore(*): add test for canceling the row selection event
Jan 29, 2021
d022e56
chore(*): add selection service api tests
Jan 29, 2021
d2083b2
Merge branch 'master' into mevtimov/feat-8040
kdinev Feb 2, 2021
9b418a9
chore(*): added onSelectedRowChange event tests
Feb 2, 2021
f1b19d6
chore(*): fix requested changes
Feb 4, 2021
60df17c
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Feb 4, 2021
1a8338d
chore(*): fix preselected rows
Feb 9, 2021
101c98b
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Feb 9, 2021
0037839
chore(*): fix testing issues
Feb 9, 2021
b8cb930
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Feb 9, 2021
8a7fe65
chore(*): fix onActionClick event name
Feb 9, 2021
47f9570
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Feb 9, 2021
3342012
chore(*): fix some of the requiested changes
Feb 12, 2021
9d13119
chore(*): add coments and type request changes
Feb 12, 2021
febffc3
chore(*): fix lint errors
Feb 12, 2021
4d12636
chore(*): add some requested changes
Feb 12, 2021
7a13546
chore(*): add requested changes for get_all_children
Feb 12, 2021
e777c07
chore(*): add requested changes for updateCascadeSelectionOnFilterAnd…
Feb 12, 2021
1590407
chore(*): modify calculateRowsNewSelectionState and dev sample
Feb 12, 2021
0038568
Merge branch 'master' into mevtimov/feat-8040
teodosiah Feb 12, 2021
49bdee9
chore(*): fix lint errors
Feb 12, 2021
589ad47
chore(*): move cascade selection to tree-grid-selection service
Feb 15, 2021
93f6f86
Merge branch 'master' into mevtimov/feat-8040
teodosiah Feb 15, 2021
0ed1197
chore(*): fix lint issues
Feb 15, 2021
0b64541
chore(*): fix lint errors
Feb 15, 2021
97bed59
Merge branch 'master' into mevtimov/feat-8040
kdinev Feb 15, 2021
ef23d52
chore(*): modify some tests
Feb 16, 2021
d959c4d
Merge branch 'mevtimov/feat-8040' of https://github.com/IgniteUI/igni…
Feb 16, 2021
4f96633
Merge branch 'master' into mevtimov/feat-8040
DiyanDimitrov Feb 16, 2021
cc69f1a
Merge branch 'master' into mevtimov/feat-8040
kdinev Feb 16, 2021
2ae4eb1
chore(*): added requested changes
Feb 16, 2021
ca14b6e
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
Feb 16, 2021
59a912f
Merge branch 'mevtimov/feat-8040' of https://github.com/IgniteUI/igni…
Feb 16, 2021
6f05d55
chore(*): added requested changes
Feb 16, 2021
dedc8d8
chore(*): fix failed tests
Feb 16, 2021
d021e78
Merge branch 'master' into mevtimov/feat-8040
kdinev Feb 16, 2021
7320872
Merge branch 'master' into mevtimov/feat-8040
zdrawku Feb 16, 2021
b61348e
chore(*): clean up leftover changes
Feb 16, 2021
a4de69e
Merge branch 'mevtimov/feat-8040' of https://github.com/IgniteUI/igni…
Feb 16, 2021
2ee3aa6
Merge branch 'master' into mevtimov/feat-8040
zdrawku Feb 16, 2021
d956838
Merge branch 'master' into mevtimov/feat-8040
zdrawku Feb 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ All notable changes for each version of this project will be documented in this
- The `igx-drop-down-item` now allows for `igxPrefix`, `igxSuffix` and `igx-divider` directives to be passed as `ng-content` and they will be renderer accordingly in the item's content.
- `IgxGrid`
- Added support for exporting grouped data.
- `IgxTreeGrid`
- Added `multipleCascade` row selection mode. In this mode, selecting a record results in the selection of all its children recursively. When only some children are selected, their parent's checkbox is in an indeterminate state.


```html
<igx-tree-grid [rowSelection]="'multipleCascade'">
</igx-tree-grid>
```
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
- Support for `currency` type columns is added in the grid.
- Added support for filtering based on the formatted cell values using the `FormattedValuesFilteringStrategy` for `IgxGrid`/`IgxHierarchicalGrid` and `TreeGridFormattedValuesFilteringStrategy` for `IgxTreeGrid`.
Expand Down
3 changes: 2 additions & 1 deletion projects/igniteui-angular/src/lib/grids/common/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export type GridKeydownTargetType =
export const GridSelectionMode = mkenum({
none: 'none',
single: 'single',
multiple: 'multiple'
multiple: 'multiple',
multipleCascade: 'multipleCascade'
});
export type GridSelectionMode = (typeof GridSelectionMode)[keyof typeof GridSelectionMode];

Expand Down
15 changes: 6 additions & 9 deletions projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2035,11 +2035,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
*/
@Input()
public set selectedRows(rowIDs: any[]) {
if (rowIDs.length > 0) {
this.selectRows(rowIDs, true);
} else {
this.deselectAllRows();
}
this.selectRows(rowIDs || [], true);
}

public get selectedRows(): any[] {
Expand Down Expand Up @@ -2590,8 +2586,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
* Gets/Sets row selection mode
*
* @remarks
* By default the row selection mode is none
* @param selectionMode: GridSelectionMode
* By default the row selection mode is 'none'
* Note that in IgxGrid and IgxHierarchicalGrid 'multipleCascade' behaves like 'multiple'
*/
@WatchChanges()
@Input()
Expand All @@ -2601,7 +2597,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements

public set rowSelection(selectionMode: GridSelectionMode) {
this._rowSelectionMode = selectionMode;
if (this.gridAPI.grid && this.columnList) {
if (!this._init) {
this.selectionService.clearAllSelectedRows();
this.notifyChanges(true);
}
Expand Down Expand Up @@ -3040,7 +3036,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
* @hidden @internal
*/
public get isMultiRowSelectionEnabled(): boolean {
return this.rowSelection === GridSelectionMode.multiple;
return this.rowSelection === GridSelectionMode.multiple
|| this.rowSelection === GridSelectionMode.multipleCascade;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,6 @@ describe('IgxGrid - Row Selection #grid', () => {
it('Should bind selectedRows properly', () => {
fix.componentInstance.selectedRows = [1, 2, 3];
fix.detectChanges();

expect(grid.getRowByIndex(0).selected).toBeTrue();
expect(grid.getRowByIndex(4).selected).toBeFalse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { IgxGridSummaryService } from '../summaries/grid-summary.service';
import { IgxGridSelectionService, IgxGridCRUDService } from '../selection/selection.service';
import { IgxForOfSyncService, IgxForOfScrollSyncService } from '../../directives/for-of/for_of.sync.service';
import { IgxGridMRLNavigationService } from '../grid-mrl-navigation.service';
import { FilterMode } from '../common/enums';
import { FilterMode, GridSelectionMode } from '../common/enums';
import { GridType } from '../common/grid.interface';
import { IgxGroupByRowSelectorDirective } from '../selection/row-selectors';

Expand Down Expand Up @@ -482,7 +482,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
return res;
}
const rList = this._groupsRowList.filter(item => item.element.nativeElement.parentElement !== null)
.sort((item1, item2) => item1.index - item2.index);
.sort((item1, item2) => item1.index - item2.index);
res.reset(rList);
return res;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { IgxForOfSyncService, IgxForOfScrollSyncService } from '../../directives
import { GridType } from '../common/grid.interface';
import { IgxRowIslandAPIService } from './row-island-api.service';
import { IgxGridToolbarDirective, IgxGridToolbarTemplateContext } from '../toolbar/common';
import { GridSelectionMode } from '../common/enums';

let NEXT_ID = 0;

Expand Down Expand Up @@ -242,7 +243,7 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
*/
@Input()
public set expandChildren(value: boolean) {
this._defaultExpandState = value;
this._defaultExpandState = value;
this.expansionStates = new Map<any, boolean>();
}

Expand All @@ -256,7 +257,7 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
* @memberof IgxHierarchicalGridComponent
*/
public get expandChildren(): boolean {
return this._defaultExpandState ;
return this._defaultExpandState;
}

/**
Expand Down Expand Up @@ -358,16 +359,16 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
this.dragIndicatorIconTemplate = this.parentIsland ?
this.parentIsland.dragIndicatorIconTemplate :
this.dragIndicatorIconTemplate;
this.rowExpandedIndicatorTemplate = this.rootGrid.rowExpandedIndicatorTemplate;
this.rowCollapsedIndicatorTemplate = this.rootGrid.rowCollapsedIndicatorTemplate;
this.rowExpandedIndicatorTemplate = this.rootGrid.rowExpandedIndicatorTemplate;
this.rowCollapsedIndicatorTemplate = this.rootGrid.rowCollapsedIndicatorTemplate;
this.headerCollapseIndicatorTemplate = this.rootGrid.headerCollapseIndicatorTemplate;
this.headerExpandIndicatorTemplate = this.rootGrid.headerExpandIndicatorTemplate;
this.excelStyleHeaderIconTemplate = this.rootGrid.excelStyleHeaderIconTemplate;
this.hasChildrenKey = this.parentIsland ?
this.parentIsland.hasChildrenKey || this.rootGrid.hasChildrenKey :
this.rootGrid.hasChildrenKey;
this.showExpandAll = this.parentIsland ?
this.parentIsland.showExpandAll : this.rootGrid.showExpandAll;
this.parentIsland.hasChildrenKey || this.rootGrid.hasChildrenKey :
this.rootGrid.hasChildrenKey;
this.showExpandAll = this.parentIsland ?
this.parentIsland.showExpandAll : this.rootGrid.showExpandAll;

this.excelStyleFilteringComponents = this.parentIsland ?
this.parentIsland.excelStyleFilteringComponents :
Expand Down Expand Up @@ -572,14 +573,14 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
* @internal
*/
public hasExpandedRecords() {
if (this.expandChildren) {
if (this.expandChildren) {
return true;
}
let hasExpandedEntry = false;
this.expansionStates.forEach(value => {
if (value) {
hasExpandedEntry = value;
}
}
let hasExpandedEntry = false;
this.expansionStates.forEach(value => {
if (value) {
hasExpandedEntry = value;
}
});
return hasExpandedEntry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
rowIsland1.rowSelection = GridSelectionMode.multiple;
fix.componentInstance.selectedRows = ['0', '2', '3'];
fix.detectChanges();

expect(hierarchicalGrid.getRowByKey('0').selected).toBeTrue();
expect(hierarchicalGrid.getRowByKey('1').selected).toBeFalse();

Expand Down
4 changes: 2 additions & 2 deletions projects/igniteui-angular/src/lib/grids/row.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
if (this.grid.rowSelection === 'none' || this.deleted || !this.grid.selectRowOnClick) {
return;
}
if (event.shiftKey && this.grid.rowSelection === 'multiple') {
if (event.shiftKey && this.grid.isMultiRowSelectionEnabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

this.selectionService.selectMultipleRows(this.rowID, this.rowData, event);
return;
}
Expand Down Expand Up @@ -436,7 +436,7 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
*/
public onRowSelectorClick(event) {
event.stopPropagation();
if (event.shiftKey && this.grid.rowSelection === 'multiple') {
if (event.shiftKey && this.grid.isMultiRowSelectionEnabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

this.selectionService.selectMultipleRows(this.rowID, this.rowData, event);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FilteringExpressionsTree } from '../../data-operations/filtering-expres
import { IGridEditEventArgs, IGridEditDoneEventArgs } from '../common/events';
import { GridType } from '../common/grid.interface';
import { IgxGridBaseDirective } from '../grid/public_api';
import { IgxTreeGridAPIService } from '../tree-grid/public_api';

export interface GridSelectionRange {
rowStart: number;
Expand Down Expand Up @@ -75,7 +76,7 @@ export class IgxRow {

createDoneEditEventArgs(cachedRowData: any, event?: Event): IGridEditDoneEventArgs {
const updatedData = this.grid.transactions.enabled ?
this.grid.transactions.getAggregatedValue(this.id, true) : this.grid.gridAPI.getRowData(this.id);
this.grid.transactions.getAggregatedValue(this.id, true) : this.grid.gridAPI.getRowData(this.id);
const rowData = updatedData === null ? this.grid.gridAPI.getRowData(this.id) : updatedData;
const args: IGridEditDoneEventArgs = {
rowID: this.id,
Expand Down Expand Up @@ -131,7 +132,7 @@ export class IgxCell {

createDoneEditEventArgs(value: any, event?: Event): IGridEditDoneEventArgs {
const updatedData = this.grid.transactions.enabled ?
this.grid.transactions.getAggregatedValue(this.id.rowID, true) : this.rowData;
this.grid.transactions.getAggregatedValue(this.id.rowID, true) : this.rowData;
const rowData = updatedData === null ? this.grid.gridAPI.getRowData(this.id.rowID) : updatedData;
const args: IGridEditDoneEventArgs = {
rowID: this.id.rowID,
Expand Down Expand Up @@ -228,7 +229,7 @@ export class IgxGridCRUDService {
}
/** Changing the reference with the new editable cell */
const newCell = this.createCell(cell);
if (this.rowEditing) {
if (this.rowEditing) {
const canceled = this.beginRowEdit(newCell, event);
if (!canceled) {
this.beginCellEdit(newCell, event);
Expand Down Expand Up @@ -394,6 +395,7 @@ export class IgxGridSelectionService {
_ranges: Set<string> = new Set<string>();
_selectionRange: Range;
rowSelection: Set<any> = new Set<any>();
indeterminateRows: Set<any> = new Set<any>();
columnSelection: Set<string> = new Set<string>();
/**
* @hidden @internal
Expand Down Expand Up @@ -759,12 +761,16 @@ export class IgxGridSelectionService {
return this.rowSelection.size ? Array.from(this.rowSelection.keys()) : [];
}

/** Returns array of the rows in indeterminate state. */
getIndeterminateRows(): Array<any> {
return this.indeterminateRows.size ? Array.from(this.indeterminateRows.keys()) : [];
}

/** Clears row selection, if filtering is applied clears only selected rows from filtered data. */
clearRowSelection(event?): void {
const removedRec = this.isFilteringApplied() ?
this.getRowIDs(this.allData).filter(rID => this.isRowSelected(rID)) : this.getSelectedRows();
const newSelection = this.isFilteringApplied() ? this.getSelectedRows().filter(x => !removedRec.includes(x)) : [];

this.emitRowSelectionEvent(newSelection, [], removedRec, event);
}

Expand All @@ -773,6 +779,7 @@ export class IgxGridSelectionService {
const allRowIDs = this.getRowIDs(this.allData);
const addedRows = allRowIDs.filter((rID) => !this.isRowSelected(rID));
const newSelection = this.rowSelection.size ? this.getSelectedRows().concat(addedRows) : addedRows;
this.indeterminateRows.clear();
this.selectedRowsChange.next();
this.emitRowSelectionEvent(newSelection, addedRows, [], event);
}
Expand Down Expand Up @@ -824,6 +831,10 @@ export class IgxGridSelectionService {
return this.rowSelection.size > 0 && this.rowSelection.has(rowID);
}

isRowInIndeterminateState(rowID): boolean {
return this.indeterminateRows.size > 0 && this.indeterminateRows.has(rowID);
}

/** Select range from last selected row to the current specified row. */
selectMultipleRows(rowID, rowData, event?): void {
this.allRowsSelected = undefined;
Expand Down Expand Up @@ -904,6 +915,7 @@ export class IgxGridSelectionService {
/** Clear rowSelection and update checkbox state */
public clearAllSelectedRows(): void {
this.rowSelection.clear();
this.indeterminateRows.clear();
this.clearHeaderCBState();
this.selectedRowsChange.next();
}
Expand Down Expand Up @@ -1041,7 +1053,7 @@ export class IgxGridSelectionService {
this.columnSelection.clear();
}

private areEqualCollections(first, second): boolean {
protected areEqualCollections(first, second): boolean {
return first.length === second.length && new Set(first.concat(second)).size === first.length;
}

Expand All @@ -1057,4 +1069,4 @@ export class IgxGridSelectionService {
}

export const isChromium = (): boolean => (/Chrom|e?ium/g.test(navigator.userAgent) ||
/Google Inc/g.test(navigator.vendor)) && !/Edge/g.test(navigator.userAgent);
/Google Inc/g.test(navigator.vendor)) && !/Edge/g.test(navigator.userAgent);
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<IgxTreeGridCompone
const row = grid.records.get(rowID);
if (row.expanded === expanded ||
((!row.children || !row.children.length) && (!grid.loadChildrenOnDemand ||
(grid.hasChildrenKey && !row.data[grid.hasChildrenKey])))) {
(grid.hasChildrenKey && !row.data[grid.hasChildrenKey])))) {
return false;
}
return true;
Expand Down Expand Up @@ -84,10 +84,10 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<IgxTreeGridCompone
public deleteRowById(rowID: any) {
const treeGrid = this.grid;
const flatDataWithCascadeOnDeleteAndTransactions =
treeGrid.primaryKey &&
treeGrid.foreignKey &&
treeGrid.cascadeOnDelete &&
treeGrid.transactions.enabled;
treeGrid.primaryKey &&
treeGrid.foreignKey &&
treeGrid.cascadeOnDelete &&
treeGrid.transactions.enabled;

if (flatDataWithCascadeOnDeleteAndTransactions) {
treeGrid.transactions.startPending();
Expand Down Expand Up @@ -180,7 +180,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<IgxTreeGridCompone
if (!parentRecord) {
throw Error('Invalid parent row ID!');
}
this.grid.summaryService.clearSummaryCache({rowID: parentRecord.rowID});
this.grid.summaryService.clearSummaryCache({ rowID: parentRecord.rowID });
if (this.grid.primaryKey && this.grid.foreignKey) {
data[this.grid.foreignKey] = parentRowID;
super.addRowToData(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,41 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => {
TreeGridFunctions.verifyTreeRowSelectionByIndex(fix, 4, true);
expect(treeGrid.selectedRows).toEqual([1, 6, 10]);
});

it('check row selection within multipleCascade selection mode when expand a row', fakeAsync(() => {
treeGrid.rowSelection = GridSelectionMode.multipleCascade;
fix.detectChanges();

treeGrid.selectRows([1]);
fix.detectChanges();

expect(treeGrid.selectedRows).toEqual([1]);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 0, true, true);

treeGrid.expandRow(1);
fix.detectChanges();
tick(1000);
fix.detectChanges();

expect(treeGrid.rowList.length).toBe(5);
expect(treeGrid.selectedRows.length).toBe(3);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 0, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 1, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 2, true, true);

treeGrid.expandRow(2);
fix.detectChanges();
tick(1000);
fix.detectChanges();

expect(treeGrid.rowList.length).toBe(7);
expect(treeGrid.selectedRows.length).toBe(5);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 0, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 1, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 2, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 3, true, true);
TreeGridFunctions.verifyRowByIndexSelectionAndCheckboxState(fix, 4, true, true);
}));
});

describe('ChildDataKey', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
[tabindex]="-1"
[readonly]="true"
[checked]="selected"
[indeterminate]="indeterminate"
[disabled]="deleted"
disableRipple="true"
[disableTransitions]="grid.disableTransitions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ export class IgxTreeGridRowComponent extends IgxRowDirective<IgxTreeGridComponen
this.treeRow.children && this.treeRow.children.length;
}

/**
* @hidden
*/
get indeterminate(): boolean {
return this.selectionService.isRowInIndeterminateState(this.rowID);
}

/**
* @hidden
*/
Expand Down
Loading