Hi,
I have a scenario where I have two grids in igx-tabs-group and on form load by default I need the first rows in both grids should be selected.
I have the below two lines of code in ngAfterViewInit() and I see on the first grid row is being selected and highlighted whereas in second grid the row is not selected.
this.grid1.selectRows(['1'], true);
this.grid1.markForCheck();
this.grid2.selectRows(['1'], true);
this.grid2.markForCheck();
Thanks,
Mani
Hello,
Thank you for posting on our forums.
In order for rowSelection to work, you must have primaryKey for each grid defined. Then for each grid, you must execute the command respectively:
this.grid.selectRows(['primaryKey'], true);
I would assume that in your second grid the primary key is either not defined, or '1' is not an existing key.
Here is a sample with duplicate keys:
https://stackblitz.com/edit/igxgrid-igxcelleditor-onkeyup-yxyr9n?file=src%2Fapp%2Fgrid%2Fgrid-sample%2Fgrid-sample.component.ts
If you need further assistance, please let me know.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics