2

I am using Infragistics grid. I have several columns, and I am trying to access the value of the first column inside the last one.

I created a variable inside IgxColumnComponent, however when I access it from another IgxColumnComponent I get [object][object]

Object is like bellow

<igx-column #docid field="documentId" header="Document Id" [filterable]="true" dataType="string" style="font-size:20px">

</igx-column>

<igx-column field="source" header="Source" [filterable]="true" dataType="string" style="font-size:10px">
    <ng-template igxCell let-cell="cell">
        <div *ngIf="cell.value==2">
            <span>
                {{docid}}
                <img src="../../assets/icons/po-ack-Icon.png" />
            </span>
        </div>
    </ng-template>
</igx-column>
Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
  • Please provide a minimal reproducible code example as a starting point, for example, an Angular project in https://stackblitz.com/. It's then way easier to help you. Read more about it at https://stackoverflow.com/help/minimal-reproducible-example –  Dec 30 '20 at 20:29

1 Answers1

3

Another IgxColumnComponent’s field value can be accessed from the IgxCell’s rowData property:

<igx-column field="source"header="Source" [filterable]="true"
            dataType="string" style="font-size:10px">
  <ng-template igxCell let-cell="cell">
    <div *ngIf="cell.rowData.DocumentId==2">
      <span>
        {{cell.rowData.DocumentId}}
      </span>
    </div>
  </ng-template>
</igx-column>

Here is a stackblitz sample that demonstrates this.

Additionally, all the IgxCell’s properties are listed in the Infragistics documentation here and more about IgxColumnComponent can be found here.

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100