Skip to content

igx-grid - Add row attributes #11334

Discussion options

You must be logged in to vote

If anyone comes here in the future and wants to do something like this, this is how I achieved it:

this.grid.verticalScrollContainer.chunkLoad.pipe(takeUntil(this._destroySubject)).subscribe(() => {
  const rowList = this.grid.dataRowList;
  rowList.forEach(row => {
    if ((row as any).automationKey !== row.key) {
      (row as any).automationKey = row.key;
      this._renderer2.setAttribute(row.element.nativeElement, 'data-ex-key', row.key);
      const entityName = row.data.entityId || row.data.name;
      if (entityName) {
        this._renderer2.setAttribute(row.element.nativeElement, 'data-ex-name', entityName);
      }
    }
  });
});

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mikerentmeister
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants