-
- {{ sortDirection < 2 ? 'arrow_upward' : 'arrow_downward' }}
-
+
+
+
-
-
+
\ No newline at end of file
diff --git a/projects/igniteui-angular/src/lib/grids/headers/grid-header.component.ts b/projects/igniteui-angular/src/lib/grids/headers/grid-header.component.ts
index 07b83d68f42..ed68d5af856 100644
--- a/projects/igniteui-angular/src/lib/grids/headers/grid-header.component.ts
+++ b/projects/igniteui-angular/src/lib/grids/headers/grid-header.component.ts
@@ -44,6 +44,12 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
@ViewChild('defaultESFHeaderIconTemplate', { read: TemplateRef, static: true })
protected defaultESFHeaderIconTemplate: TemplateRef
;
+ /**
+ * @hidden
+ */
+ @ViewChild('defaultSortHeaderIconTemplate', { read: TemplateRef, static: true })
+ protected defaultSortHeaderIconTemplate;
+
/**
* Returns the `aria-selected` of the header.
*/
@@ -131,6 +137,21 @@ export class IgxGridHeaderComponent implements DoCheck, OnDestroy {
return this.grid.excelStyleHeaderIconTemplate || this.defaultESFHeaderIconTemplate;
}
+ /**
+ * @hidden
+ */
+ public get sortIconTemplate() {
+ if (this.sortDirection === SortingDirection.None && this.grid.sortHeaderIconTemplate) {
+ return this.grid.sortHeaderIconTemplate;
+ } else if (this.sortDirection === SortingDirection.Asc && this.grid.sortAscendingHeaderIconTemplate) {
+ return this.grid.sortAscendingHeaderIconTemplate;
+ } else if (this.sortDirection === SortingDirection.Desc && this.grid.sortDescendingHeaderIconTemplate) {
+ return this.grid.sortDescendingHeaderIconTemplate;
+ } else {
+ return this.defaultSortHeaderIconTemplate;
+ }
+ }
+
public get sorted() {
return this.sortDirection !== SortingDirection.None;
}
diff --git a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts
index 0c25dd36446..fc76d90dc71 100644
--- a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts
+++ b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts
@@ -441,6 +441,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
this.headerCollapseIndicatorTemplate = this.rootGrid.headerCollapseIndicatorTemplate;
this.headerExpandIndicatorTemplate = this.rootGrid.headerExpandIndicatorTemplate;
this.excelStyleHeaderIconTemplate = this.rootGrid.excelStyleHeaderIconTemplate;
+ this.sortAscendingHeaderIconTemplate = this.rootGrid.sortAscendingHeaderIconTemplate;
+ this.sortDescendingHeaderIconTemplate = this.rootGrid.sortDescendingHeaderIconTemplate;
+ this.sortHeaderIconTemplate = this.rootGrid.sortHeaderIconTemplate;
this.hasChildrenKey = this.parentIsland ?
this.parentIsland.hasChildrenKey || this.rootGrid.hasChildrenKey :
this.rootGrid.hasChildrenKey;
diff --git a/projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts b/projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts
index 35de81a1d9d..5681573e413 100644
--- a/projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts
+++ b/projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts
@@ -1819,7 +1819,7 @@ export class GridFunctions {
public static getColumnGroupHeaderCell(columnField: string, fix: ComponentFixture) {
const headerTitle = fix.debugElement.queryAll(By.css(GROUP_HEADER_CLASS))
- .find(header => header.nativeElement.title === columnField);
+ .find(header => header.nativeElement.title === columnField);
return headerTitle.parent;
}
@@ -1867,7 +1867,7 @@ export class GridFunctions {
}
public static getHeaderSortIcon(header: DebugElement): DebugElement {
- return header.query(By.css(SORT_ICON_CLASS));
+ return header.query(By.css(SORT_ICON_CLASS))?.query(By.css('igx-icon'));
}
public static getHeaderFilterIcon(header: DebugElement): DebugElement {
diff --git a/projects/igniteui-angular/src/lib/test-utils/grid-samples.spec.ts b/projects/igniteui-angular/src/lib/test-utils/grid-samples.spec.ts
index 775c8d7577a..9d8e441a11f 100644
--- a/projects/igniteui-angular/src/lib/test-utils/grid-samples.spec.ts
+++ b/projects/igniteui-angular/src/lib/test-utils/grid-samples.spec.ts
@@ -7,7 +7,7 @@ import {
} from './grid-base-components.spec';
import { IGridSelection } from './grid-interfaces.spec';
import { SampleTestData, DataParent } from './sample-test-data.spec';
-import { ColumnDefinitions, GridTemplateStrings, EventSubscriptions } from './template-strings.spec';
+import { ColumnDefinitions, GridTemplateStrings, EventSubscriptions, TemplateDefinitions } from './template-strings.spec';
import { IgxColumnComponent } from '../grids/columns/column.component';
import { IgxFilteringOperand, IgxNumberFilteringOperand } from '../data-operations/filtering-condition';
import { ExpressionUI } from '../grids/filtering/grid-filtering.service';
@@ -2276,7 +2276,10 @@ export class NoColumnWidthGridComponent extends BasicGridComponent {
template: GridTemplateStrings.declareGrid(
'',
'',
- ColumnDefinitions.idFirstLastNameSortable)
+ ColumnDefinitions.idFirstLastNameSortable,
+ '',
+ '',
+ TemplateDefinitions.sortIconTemplates)
})
export class SortByParityComponent extends GridDeclaredColumnsComponent implements ISortingStrategy {
public sort(data: any[], fieldName: string, dir: SortingDirection) {
diff --git a/projects/igniteui-angular/src/lib/test-utils/template-strings.spec.ts b/projects/igniteui-angular/src/lib/test-utils/template-strings.spec.ts
index 0af0edf9b6c..a0253b287fc 100644
--- a/projects/igniteui-angular/src/lib/test-utils/template-strings.spec.ts
+++ b/projects/igniteui-angular/src/lib/test-utils/template-strings.spec.ts
@@ -19,14 +19,15 @@ export class GridTemplateStrings {
`;
public static declareGrid(attributes = ``, events = ``, columnDefinitions: ColumnDefinitions = ``,
- toolbarDefinition = '', paginatorDefinition = '') {
+ toolbarDefinition = '', paginatorDefinition = '', templateDefinitions: TemplateDefinitions = '') {
return `
- ${ toolbarDefinition }
- ${ columnDefinitions}
- ${ paginatorDefinition }
+ ${toolbarDefinition}
+ ${columnDefinitions}
+ ${paginatorDefinition}
+ ${templateDefinitions}
`;
}
@@ -489,6 +490,20 @@ export class ColumnDefinitions {
`;
}
+export class TemplateDefinitions {
+ public static sortIconTemplates = `
+
+ unfold_more
+
+
+ expand_less
+
+
+ expand_more
+
+ `;
+}
+
export class EventSubscriptions {
public static columnInit = ` (columnInit)="columnInit($event)"`;