Skip to content
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

fix(grid): fix getCellByColumn with virtualization #10172 #10250

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c3a4b5f
feat(changes): push changes initial
Volen99 Sep 30, 2021
6d59501
feat(exporters): add providedIn root to exporters
igdmdimitrov Sep 30, 2021
3ff2bdc
Merge branch 'master' into dmdimitrov/exporters-import
igdmdimitrov Sep 30, 2021
aeebe04
chore(*): remove fit from test
hanastasov Sep 30, 2021
58aebb3
chore(*): fix lint errros
Volen99 Oct 1, 2021
5fed227
chore(*): fix lint errros
Volen99 Oct 1, 2021
3509868
fix(grid): fix 4 buggy tests
Volen99 Oct 1, 2021
c014257
Merge branch 'master' into dmdimitrov/exporters-import
igdmdimitrov Oct 1, 2021
db6562a
fix(grid): fix tree-grid-integration test
Volen99 Oct 1, 2021
cc6ce6f
Merge branch 'master' into dmdimitrov/exporters-import
igdmdimitrov Oct 4, 2021
b1c6a6a
Merge branch 'master' into VDyulgerov/fix-IgxGridStateDirective-state…
hanastasov Oct 5, 2021
99c0401
Merge branch 'master' into dmdimitrov/exporters-import
gedinakova Oct 5, 2021
31c1ce6
fix(grid): fix 4 buggy tests
Volen99 Oct 5, 2021
3d51615
Merge branch 'VDyulgerov/fix-IgxGridStateDirective-state-master' of h…
Volen99 Oct 5, 2021
ef50acf
fix(esf): add empty filter if no filter is applied
igdmdimitrov Oct 5, 2021
ff6e5bf
test(grid): dont use detect changes after pinning/unpinning
hanastasov Oct 5, 2021
60e1f1f
test(grid): dont use detect changes after pinning/unpinning
hanastasov Oct 5, 2021
c2c18d7
chore(*): fix lint error, change let with const
hanastasov Oct 5, 2021
1ee4aff
fix(hierarchical-grid): add correct check for row and expansion indexes
dobromirts Oct 6, 2021
21a28ac
chore(*): removed optional decorators
igdmdimitrov Oct 6, 2021
95bd015
fix(grid): add index to pinRow function
Volen99 Oct 6, 2021
83e62a9
chore(*): comment an expect test
Volen99 Oct 6, 2021
42420a4
chore(*): remove commented expect, remove array index
Volen99 Oct 7, 2021
7c56cfd
chore(grid): change fit to it
Volen99 Oct 7, 2021
210896a
Update projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
hanastasov Oct 7, 2021
ee0fdf3
Update src/app/grid-state/grid-state.component.ts
hanastasov Oct 7, 2021
2ada0c5
Update src/app/grid-row-pinning/grid-row-pinning.sample.ts
hanastasov Oct 7, 2021
c53c662
chore(*): update the changelog
hanastasov Oct 7, 2021
99b22a5
Merge pull request #10218 from IgniteUI/VDyulgerov/fix-IgxGridStateDi…
zdrawku Oct 7, 2021
196a289
Merge branch 'master' into dmdimitrov/exporters-import
kdinev Oct 7, 2021
5a5a583
chore(*): updated changelog
igdmdimitrov Oct 7, 2021
80dd86d
Merge branch 'dmdimitrov/exporters-import'
igdmdimitrov Oct 7, 2021
15c0d62
fix(grid): fix getCellByColumn with virtualization #10172
dobromirts Oct 7, 2021
e3d9578
Merge branch 'master' into dTsvetkov/fix-9782-master
kdinev Oct 7, 2021
7fc327b
Merge pull request #10220 from IgniteUI/dmdimitrov/exporters-import
kdinev Oct 7, 2021
c8e0180
Merge branch 'master' into dTsvetkov/fix-10172-12.2.x
hanastasov Oct 8, 2021
530bc16
Merge branch 'master' into dTsvetkov/fix-9782-master
hanastasov Oct 8, 2021
d0285ae
Merge branch 'master' into dmdimitrov/fix-10005-master
igdmdimitrov Oct 8, 2021
da16344
fix(checkbox, switch): formgroup.reset() isn't working (#10249)
kdinev Oct 8, 2021
092f594
Merge branch 'master' into dTsvetkov/fix-9782-master
hanastasov Oct 8, 2021
6862e83
Merge branch 'master' into dmdimitrov/fix-10005-master
igdmdimitrov Oct 8, 2021
5c1ac5d
Merge pull request #10241 from IgniteUI/dTsvetkov/fix-9782-master
kdinev Oct 8, 2021
d688d5b
chore(*): fixed filtering tests
igdmdimitrov Oct 11, 2021
086bcf4
Merge branch 'master' into dmdimitrov/fix-10005-master
igdmdimitrov Oct 11, 2021
7d069c2
fix(overlay): overlay wrapper and element animation should start tog…
PlamenaMiteva Oct 11, 2021
b576ecf
Merge branch 'master' into dmdimitrov/fix-10005-master
igdmdimitrov Oct 11, 2021
02d1c77
chore(*): update cell merging with issue link
kdinev Oct 11, 2021
dc629e2
Update ROADMAP.md
kdinev Oct 11, 2021
c8c3723
Merge branch 'master' into dmdimitrov/fix-10005-master
igdmdimitrov Oct 11, 2021
c1bdc45
fix(esf): add empty filter to filtering event
igdmdimitrov Oct 11, 2021
5348e67
docs(readme): adding app builder links
kdinev Oct 11, 2021
791b9a5
refactor(icon-service): cache svg icons as text (#10202)
simeonoff Oct 11, 2021
672ae89
Merge pull request #10270 from IgniteUI/kdinev-patch-1
kdinev Oct 11, 2021
1e36b86
fix(icon-service): can't register icon w/o family
simeonoff Oct 11, 2021
3a9c1e8
Merge branch 'master' into simeonoff/fix-9975
simeonoff Oct 11, 2021
ffef918
Merge branch 'master' into dmdimitrov/fix-10005-master
kdinev Oct 11, 2021
64690d3
fix(overlay): fix overlay closing animation duration
PlamenaMiteva Oct 11, 2021
13f2c8c
fix(grid): update extractDataFromSelection method
viktorkombov Oct 12, 2021
97ecddd
Merge pull request #10237 from IgniteUI/dmdimitrov/fix-10005-master
kdinev Oct 12, 2021
3e12fd9
Merge branch 'master' into PMiteva/overlay-closing-animation-v.13.0
Lipata Oct 12, 2021
d8507f8
Merge pull request #10278 from IgniteUI/PMiteva/overlay-closing-anima…
Lipata Oct 12, 2021
5687ab5
feat(dialog): update dialog's show/hide animations to fadeIn/fadeOut …
PlamenaMiteva Oct 12, 2021
65ac280
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
viktorkombov Oct 14, 2021
addda51
test(grid): add unit test covering all the new code
viktorkombov Oct 14, 2021
6f0ef30
Merge branch 'master' into simeonoff/fix-9975
kdinev Oct 15, 2021
f6f6612
Merge pull request #10281 from IgniteUI/vkombov/fix-10276-master
kdinev Oct 15, 2021
2e6850d
Merge branch 'master' into simeonoff/fix-9975
kdinev Oct 15, 2021
e7a9d07
Merge pull request #10274 from IgniteUI/simeonoff/fix-9975
kdinev Oct 18, 2021
cbf6d6c
Merge branch 'master' into dTsvetkov/fix-10172-12.2.x
hanastasov Oct 18, 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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes for each version of this project will be documented in this file.

## 13.0.0

### New Features
- `IgxCsvExporterService`, `IgxExcelExporterService`
- Exporter services are no longer required to be provided in the application since they are now injected on a root level.

## 12.2.1

### New Features
- `igxGrid`, `igxHierarchicalGrid`, `igxTreeGrid`
- new `rowPinned` event is emitted after a row is pinned/unpinned and grid has already refreshed its state to represent the pinned/unpinned rows in the DOM.

## 12.2.0

### New Features
Expand Down
20 changes: 18 additions & 2 deletions projects/igniteui-angular/src/lib/grids/grid-base.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import {
Action,
} from '../services/public_api';
import { GridBaseAPIService } from './api.service';
import { IgxGridCellComponent } from './cell.component';
import { ISummaryExpression } from './summaries/grid-summary';
import { RowEditPositionStrategy, IPinningConfig } from './grid.common';
import { IgxGridToolbarComponent } from './toolbar/grid-toolbar.component';
Expand Down Expand Up @@ -941,6 +940,17 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
@Output()
public rowPinning = new EventEmitter<IPinRowEventArgs>();

/**
* Emitted when the pinned state of a row is changed.
*
* @example
* ```html
* <igx-grid [data]="employeeData" (rowPinned)="rowPin($event)" [autoGenerate]="true"></igx-grid>
* ```
*/
@Output()
public rowPinned = new EventEmitter<IPinRowEventArgs>();

/**
* Emmited when the active node is changed.
*
Expand Down Expand Up @@ -4826,6 +4836,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
if (this._pinnedRecordIDs.indexOf(rowID) !== -1) {
return false;
}

const eventArgs: IPinRowEventArgs = {
insertAtIndex: index,
isPinned: true,
Expand All @@ -4840,8 +4851,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
this._pinnedRecordIDs.splice(insertIndex, 0, rowID);
this.pipeTrigger++;
if (this.gridAPI.grid) {
this.notifyChanges();
this.cdr.detectChanges();
this.rowPinned.emit(eventArgs);
}

return true;
}

Expand All @@ -4867,12 +4880,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
row
};
this.rowPinning.emit(eventArgs);

this.crudService.endEdit(false);
this._pinnedRecordIDs.splice(index, 1);
this.pipeTrigger++;
if (this.gridAPI.grid) {
this.cdr.detectChanges();
this.rowPinned.emit(eventArgs);
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,15 @@ export class IgxGridNavigationService {
}

public isDataRow(rowIndex: number, includeSummary = false) {
let curRow: any;
if (rowIndex < 0 || rowIndex > this.grid.dataView.length - 1) {
return false;
curRow = this.grid.dataView[rowIndex - this.grid.virtualizationState.startIndex];
if (!curRow){
return false;
}
} else {
curRow = this.grid.dataView[rowIndex];
}
const curRow = this.grid.dataView[rowIndex];
return curRow && !this.grid.isGroupByRecord(curRow) && !this.grid.isDetailRecord(curRow)
&& !curRow.childGridsData && (includeSummary || !curRow.summaries);
}
Expand Down
2 changes: 1 addition & 1 deletion projects/igniteui-angular/src/lib/grids/grid-public-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ abstract class BaseRow implements RowType {
* ```
*/
public pin(): boolean {
return this.grid.pinRow(this.key);
return this.grid.pinRow(this.key, this.index);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,51 @@ describe('Row Pinning #grid', () => {
let row = grid.getRowByIndex(0);
const rowID = row.key;
row.pin();
fix.detectChanges();

// Check pinned state with getRowByIndex after pin action
expect(row.pinned).toBe(true);

expect(grid.rowPinning.emit).toHaveBeenCalledTimes(1);
expect(grid.rowPinning.emit).toHaveBeenCalledWith({
rowID,
insertAtIndex: undefined,
insertAtIndex: 0,
isPinned: true,
row
});

row = grid.getRowByIndex(0);
row.unpin();
fix.detectChanges();
// Check pinned state with getRowByIndex after unpin action
expect(row.pinned).toBe(false);

expect(grid.rowPinning.emit).toHaveBeenCalledTimes(2);
});

it('should emit rowPinned on pin/unpin.', () => {
spyOn(grid.rowPinned, 'emit').and.callThrough();

const row = grid.getRowByIndex(0);
const rowID = row.key;
row.pin();

// Check pinned state with getRowByIndex after pin action
expect(row.pinned).toBe(true);

expect(grid.rowPinned.emit).toHaveBeenCalledTimes(1);
expect(grid.rowPinned.emit).toHaveBeenCalledWith({
rowID,
insertAtIndex: 0,
isPinned: true,
row
});

row.unpin();
// Check pinned state with getRowByIndex after unpin action
expect(row.pinned).toBe(false);

expect(grid.rowPinned.emit).toHaveBeenCalledTimes(2);
});

it('should pin/unpin via grid API methods.', () => {
// pin 2nd row
grid.pinRow(fix.componentInstance.data[1]);
Expand Down Expand Up @@ -223,7 +246,6 @@ describe('Row Pinning #grid', () => {
// unpin
row = grid.gridAPI.get_row_by_index(0);
row.unpin();
fix.detectChanges();

expect(grid.pinnedRows.length).toBe(0);
pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
Expand Down Expand Up @@ -429,8 +451,7 @@ describe('Row Pinning #grid', () => {

it('should apply sorting to both pinned and unpinned rows.', () => {
grid.gridAPI.get_row_by_index(1).pin();
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(6).pin();

expect(grid.gridAPI.get_row_by_index(0).rowID).toBe(fix.componentInstance.data[1]);
expect(grid.gridAPI.get_row_by_index(1).rowID).toBe(fix.componentInstance.data[5]);
Expand Down Expand Up @@ -573,7 +594,6 @@ describe('Row Pinning #grid', () => {
it('should correctly apply paging state for grid and paginator when there are pinned rows.', () => {
// pin the first row
grid.gridAPI.get_row_by_index(0).pin();
fix.detectChanges();

expect(grid.rowList.length).toEqual(6);
expect(grid.perPage).toEqual(5);
Expand All @@ -583,7 +603,6 @@ describe('Row Pinning #grid', () => {

// pin the second row
grid.gridAPI.get_row_by_index(2).pin();
fix.detectChanges();

expect(grid.rowList.length).toEqual(7);
expect(grid.perPage).toEqual(5);
Expand All @@ -594,19 +613,17 @@ describe('Row Pinning #grid', () => {

it('should have the correct records shown for pages with pinned rows', () => {
grid.gridAPI.get_row_by_index(0).pin();
grid.gridAPI.get_row_by_index(1).pin();
fix.detectChanges();

let rows = grid.rowList.toArray();

[1, 2, 1, 2, 3, 4, 5].forEach((x, index) => expect(rows[index].cells.first.value).toEqual(x));
[1, 1, 2, 3, 4, 5].forEach((x, index) => expect(rows[index].cells.first.value).toEqual(x));

grid.paginate(2);
fix.detectChanges();

rows = grid.rowList.toArray();

[1, 2, 11, 12].forEach((x, index) => expect(rows[index].cells.first.value).toEqual(x));
[1, 11, 12].forEach((x, index) => expect(rows[index].cells.first.value).toEqual(x));
});
});

Expand Down Expand Up @@ -805,10 +822,8 @@ describe('Row Pinning #grid', () => {
// Pin/Unpin with the methods
firstRow.unpin();
expect(firstRow.pinned).toBe(false);
fix.detectChanges();
firstRow.pin();
expect(firstRow.pinned).toBe(true);
fix.detectChanges();

// Check again pinned row presence
pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
Expand Down Expand Up @@ -855,7 +870,6 @@ describe('Row Pinning #grid', () => {
it('should hide columns in pinned and unpinned area', () => {
// pin 2nd data row
grid.pinRow(fix.componentInstance.data[1]);
fix.detectChanges();
const hiddenCol = grid.columns[1];
hiddenCol.hidden = true;
fix.detectChanges();
Expand Down Expand Up @@ -892,14 +906,9 @@ describe('Row Pinning #grid', () => {

it('should keep the scrollbar sizes correct when partially filtering out pinned records', () => {
grid.gridAPI.get_row_by_index(1).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(3).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(7).pin();
fix.detectChanges();

fix.detectChanges();
// 4 records pinned + 2px border
expect(grid.pinnedRowHeight).toBe(4 * grid.renderedRowHeight + 2);
Expand Down Expand Up @@ -929,9 +938,7 @@ describe('Row Pinning #grid', () => {
it('should enter edit mode for the next editable cell when tabbing.', () => {
const gridContent = GridFunctions.getGridContent(fix);
grid.gridAPI.get_row_by_index(0).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(3).pin();
fix.detectChanges();

const firstEditable = grid.gridAPI.get_cell_by_index(0, 'CompanyName');
const secondEditable = grid.gridAPI.get_cell_by_index(1, 'CompanyName');
Expand Down Expand Up @@ -967,9 +974,7 @@ describe('Row Pinning #grid', () => {
it('should enter edit mode for the previous editable cell when shift+tabbing.', () => {
const gridContent = GridFunctions.getGridContent(fix);
grid.gridAPI.get_row_by_index(0).pin();
fix.detectChanges();
grid.gridAPI.get_row_by_index(3).pin();
fix.detectChanges();

const firstEditable = grid.gridAPI.get_cell_by_index(0, 'CompanyName');
const secondEditable = grid.gridAPI.get_cell_by_index(1, 'CompanyName');
Expand Down Expand Up @@ -1017,7 +1022,6 @@ describe('Row Pinning #grid', () => {

it('should navigate to bottom from top pinned row using Ctrl+ArrowDown', async () => {
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();

const firstRowCell = grid.gridAPI.get_row_by_index(0).cells.toArray()[1];
UIInteractions.simulateClickAndSelectEvent(firstRowCell);
Expand All @@ -1039,7 +1043,6 @@ describe('Row Pinning #grid', () => {

it('should navigate and scroll to first unpinned row from top pinned row using ArrowDown', async () => {
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();

grid.navigateTo(10);
await wait(DEBOUNCE_TIME);
Expand All @@ -1064,7 +1067,6 @@ describe('Row Pinning #grid', () => {

it('should navigate to top pinned row from bottom unpinned row without scrolling using Ctrl+ArrowUp', async () => {
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();

grid.navigateTo(27);
await wait(DEBOUNCE_TIME);
Expand Down Expand Up @@ -1095,7 +1097,6 @@ describe('Row Pinning #grid', () => {
it('should navigate to top pinned row from first unpinned row using ArrowUp', async () => {
grid.gridAPI.get_row_by_index(5).pin();
grid.gridAPI.get_row_by_index(1).pin();
fix.detectChanges();

const thirdRowCell = grid.gridAPI.get_row_by_index(2).cells.toArray()[1];
UIInteractions.simulateClickAndSelectEvent(thirdRowCell);
Expand All @@ -1118,7 +1119,6 @@ describe('Row Pinning #grid', () => {
it('should navigate and scroll to top from bottom pinned row using Ctrl+ArrowUp', async () => {
fix.componentInstance.pinningConfig = { columns: ColumnPinningPosition.Start, rows: RowPinningPosition.Bottom };
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();

grid.navigateTo(26);
await wait(DEBOUNCE_TIME);
Expand Down Expand Up @@ -1171,7 +1171,6 @@ describe('Row Pinning #grid', () => {
it('should navigate to bottom pinned row from top unpinned row without scrolling using Ctrl+ArrowDown', async () => {
fix.componentInstance.pinningConfig = { columns: ColumnPinningPosition.Start, rows: RowPinningPosition.Bottom };
grid.gridAPI.get_row_by_index(5).pin();
fix.detectChanges();

expect(grid.verticalScrollContainer.getScroll().scrollTop).toEqual(0);

Expand Down Expand Up @@ -1199,7 +1198,6 @@ describe('Row Pinning #grid', () => {
grid.gridAPI.get_row_by_index(5).pin();
grid.gridAPI.get_row_by_index(1).pin();
await wait(DEBOUNCE_TIME);
fix.detectChanges();

grid.navigateTo(26);
await wait(DEBOUNCE_TIME);
Expand Down Expand Up @@ -1228,8 +1226,6 @@ describe('Row Pinning #grid', () => {
it('should navigate down from pinned to unpinned row when there are filtered out pinned rows', async () => {
grid.gridAPI.get_row_by_index(5).pin();
grid.gridAPI.get_row_by_index(1).pin();
fix.detectChanges();

grid.filter('ID', 'B', IgxStringFilteringOperand.instance().condition('contains'), false);
fix.detectChanges();

Expand Down
12 changes: 10 additions & 2 deletions projects/igniteui-angular/src/lib/grids/grid/grid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
* @param index
*/
public getRowByIndex(index: number): RowType {
if (index < 0 || index >= this.dataView.length) {
if (index < 0) {
return undefined;
}
return this.createRow(index);
Expand Down Expand Up @@ -1140,8 +1140,16 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
*/
public createRow(index: number, data?: any): RowType {
let row: RowType;
let rec: any;

const rec: any = data ?? this.dataView[index];
if (index < 0 || index >= this.dataView.length) {
if (index >= this.dataView.length){
const virtIndex = index - this.gridAPI.grid.virtualizationState.startIndex;
rec = data ?? this.dataView[virtIndex];
}
}else {
rec = data ?? this.dataView[index];
}

if (rec && this.isGroupByRecord(rec)) {
row = new IgxGroupByRow(this, index, rec);
Expand Down
Loading