igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Feature Request: IgxGridCellComponent - easier way to access to row data in a ng-template.

Open tkiryu opened this issue 8 years ago • 1 comments

Current behavior

Currently, I have to implement {{ cell.row.rowData }} in a ng-template in order to access to its row data. I think It is inconvenient.

  <igx-column field="xxx" header="xxx" dataType="string">
    <ng-template igxCell let-cell="cell">
      <div>{{ cell.row.rowData | json }}</div>
    </ng-template>
  </igx-column>

Expected result

Ideally, I'd like to directly access to the row data like this.

  <igx-column field="xxx" header="xxx" dataType="string">
    <ng-template igxCell let-rowData="rowData">
      <div>{{ rowData | json }}</div>
    </ng-template>
  </igx-column>

It would be convenient when we want to change template according to another cell value.

  <igx-column field="xxx" header="xxx" dataType="string">
    <ng-template igxCell let-rowData="rowData">
      <button *ngIf"rowData['yyy']; else foo">
         some button
      </button>
      <ng-template #foo>
         some text
      </ng-template>
    </ng-template>
  </igx-column>
  <igx-column field="yyy" header="yyy" dataType="boolean"></igx-column>

If anyone has good way to access to row data in a ng-template, please let me know.

tkiryu avatar Mar 26 '18 14:03 tkiryu

@tkiryu There's already a way to access the row data. We won't be making the cell context heavier by exposing the entire row data.

kdinev avatar Mar 26 '18 15:03 kdinev