Skip to content

Commit 0ee7709

Browse files
authored
fix(ngx-table): Correctly check the focus on element (#236)
1 parent ba6aec0 commit 0ee7709

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

apps/table-test/src/app/app.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
<ng-template #headerTmpl> Amount </ng-template>
5353
</ngx-currency-table-cell>
5454

55+
<ngx-date-table-cell column="date">
56+
</ngx-date-table-cell>
57+
5558
<ngx-table-cell column="button">
5659
<ng-template #cellTmpl>
5760
<button>Button 1</button>

apps/table-test/src/app/app.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class AppComponent {
3131
id: 'id1',
3232
hello: 'world',
3333
amount: 37,
34+
date: '12/02/2023',
3435
},
3536
{
3637
name: 'Hyperdrive',
@@ -39,6 +40,7 @@ export class AppComponent {
3940
id: 'SHD',
4041
hello: 'world',
4142
amount: 5000,
43+
date: '12/02/2023',
4244
},
4345
{
4446
name: 'Hyperdrive',
@@ -47,6 +49,7 @@ export class AppComponent {
4749
id: 'SHD2',
4850
hello: 'world',
4951
amount: 5000,
52+
date: '12/02/2023',
5053
},
5154
];
5255

@@ -58,12 +61,13 @@ export class AppComponent {
5861
id: 'id3',
5962
hello: 'world',
6063
amount: 0.5,
64+
date: '12/02/2023',
6165
},
6266
];
6367

6468
public data = new BehaviorSubject(this.dataSet1);
6569

66-
public readonly columns = ['firstName', 'name', 'button', 'amount', 'active'];
70+
public readonly columns = ['firstName', 'name', 'date', 'button', 'amount', 'active'];
6771

6872
public showDetail = true;
6973

libs/table/src/lib/directives/tree-grid/tree-grid.cell.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class NgxTreeGridCellDirective extends NgxHasFocusDirective {
158158
element.focus();
159159

160160
// Iben: If the current active element is the same as the element we focussed, on, we break
161-
if (this.elementRef.nativeElement !== document?.activeElement) {
161+
if (element === document?.activeElement) {
162162
result = element;
163163
this.hasFocus = true;
164164

0 commit comments

Comments
 (0)