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
Refactoring filter cell navigation so that it is handled in the navigation service. Handling special scenarios for hierarchical grid in the hierarchical navigation service. #4267
Conversation
…is handled in the navigation service. Hanling special scenarios for hierarchical grid in the hierarchical navigation service.
…ilter cells in performTab since navigation should consider them only for Tab navigation (should skip them with arrow keys). Adding test.
} | ||
} | ||
|
||
public navigatePrevFilterCell(column: IgxColumnComponent, eventArgs) { | ||
const cols = this.grid.filteringService.unpinnedFilterableColumns; | ||
const prevFilterableIndex = this.grid.filteringService.unpinnedFilterableColumns.indexOf(column) - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the 'cols' variable you defined above instead of 'this.grid.filteringService.unpinnedFilterableColumns'
|
||
if (prevIndex >= 0 && visibleIndex > 0 && !this.isColumnLeftFullyVisible(prevIndex) && !column.pinned) { | ||
eventArgs.preventDefault(); | ||
this.grid.filteringService.scrollToFilterCell(this.grid.filteringService.unpinnedFilterableColumns[prevIndex], false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the 'cols' variable here as well
return; | ||
} | ||
|
||
if (nextIndex >= this.grid.filteringService.unpinnedFilterableColumns.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the 'cols' variable here.
eventArgs.preventDefault(); | ||
} else if (!column.pinned && !this.isColumnFullyVisible(nextIndex)) { | ||
eventArgs.preventDefault(); | ||
this.grid.filteringService.scrollToFilterCell(this.grid.filteringService.unpinnedFilterableColumns[nextIndex], true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the 'cols' variable here.
@@ -1,6 +1,7 @@ | |||
import { IgxGridNavigationService } from '../grid-navigation.service'; | |||
import { IgxHierarchicalGridComponent } from './hierarchical-grid.component'; | |||
import { first } from 'rxjs/operators'; | |||
import { IgxColumnComponent, FilterMode } from '../grid'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong import! Either import them from the respective files or explicitly import from the barrel file
|
||
private getLastPinnedFilterableColumn(): IgxColumnComponent { | ||
const pinnedFilterableColums = | ||
this.grid.pinnedColumns.filter(col => !(col instanceof IgxColumnGroupComponent) && col.filterable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Columns and column groups have a getter for this check: get columnGroup(): Boolean
} | ||
|
||
private getFirstPinnedFilterableColumn(): IgxColumnComponent { | ||
return this.grid.pinnedColumns.filter(col => !(col instanceof IgxColumnGroupComponent) && col.filterable)[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
const isNextChild = nextIndex <= virt.igxForOf.length - 1 && | ||
this.grid.isChildGridRecord(virt.igxForOf[nextIndex]); | ||
if (!this.grid.rowList.find(row => row.index === rowIndex + 1) && this.grid.parent && | ||
this.grid.unpinnedColumns[this.grid.unpinnedColumns.length - 1].visibleIndex === visibleColumnIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that not the same check as line 231?
public navigateNextFilterCell(column: IgxColumnComponent, eventArgs) { | ||
const cols = this.grid.filteringService.unpinnedFilterableColumns; | ||
const nextIndex = cols.indexOf(column) + 1; | ||
if (column === this.getLastPinnedFilterableColumn() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format this code
public navigatePrevFilterCell(column: IgxColumnComponent, eventArgs) { | ||
const cols = this.grid.filteringService.unpinnedFilterableColumns; | ||
const prevFilterableIndex = cols.indexOf(column) - 1; | ||
const prevIndex = cols[prevFilterableIndex].visibleIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prevFilterableIndex
can become -1 if the index of the column is 0 which will result in error getting visibleIndex
straight without a check.
|
||
if (prevIndex >= 0 && visibleIndex > 0 && !this.isColumnLeftFullyVisible(prevIndex) && !column.pinned) { | ||
eventArgs.preventDefault(); | ||
this.grid.filteringService.scrollToFilterCell(cols[prevIndex], false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If visible index is used for the prevIndex
, for the unpinned filterable columns collection the index of the column may be different that the visible index.
this.goToFirstCell(); | ||
} | ||
eventArgs.preventDefault(); | ||
} else if (!column.pinned && !this.isColumnFullyVisible(nextIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isColumnFullyVisible()
takes visible index for a column here as well.
public navigateNextFilterCell(column: IgxColumnComponent, eventArgs) { | ||
const cols = this.grid.filteringService.unpinnedFilterableColumns; | ||
const nextIndex = cols.indexOf(column) + 1; | ||
if (column === this.getLastPinnedFilterableColumn() && !this.isColumnFullyVisible(nextIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isColumnFullyVisible()
takes visible index for a column
if (this.isColumnFullyVisible(columns.length - 1)) { | ||
this.grid.filteringService.focusFilterCellChip(columns[columns.length - 1], false); | ||
const targetIndex = toStart ? 0 : columns.length - 1; | ||
const isVisible = toStart ? this.isColumnLeftFullyVisible(targetIndex) : this.isColumnFullyVisible(targetIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isColumnFullyVisible()
takes visible index and index from the unpinnedFilterableColumns
collection wouldn't work in some scenarios.
…ng sure isColumnFullyVisible uses visibleIndex, while scrollToFilterCell uses index from the unpinnedFilterableColumns collection.
@MayaKirova @mpavlinov I noticed that the Ctrl + Right Arrow is not working in an expanded child grid - it gets scrolled down and the selected cell get out of viewport:
A few more: Run the igniteui-angular-samples and open:
|
@PavlovVasil Are issues 1) and 3) related to this particular PR or are they also reproducible in branch 7.2.x? |
…not in view when moving from filter cell.
@PavlovVasil Please re-test. |
Closes #4217
Closes #4277
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes