Tihomir Tonev
Tihomir Tonev

Reputation: 145

How to get one Igx-column value into another column

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>

Upvotes: 2

Views: 1537

Answers (1)

Bozhidara Pachilova
Bozhidara Pachilova

Reputation: 78

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.

Upvotes: 3

Related Questions