3

我想知道如何将超链接添加到 igx-grid 中的单个列?这是一个示例数据:

  export const DATA: any[] = [
    {
     OrderID: 10524,
     SaleAmount: 3192.65,
     CategoryName: "Beverages",
     CompanyName: "Berglunds snabbköp",
     ShipCountry: "France",
     ShippedDate: new Date("1997-05-07T00:00:00Z"),
     Website: "https://www.infragistics.com/"
   },
   {
     OrderID: 10511,
     SaleAmount: 2550.0,
     CategoryName: "Beverages",
     CompanyName: "Bon app'",
     ShipCountry: "France",
     ShippedDate: new Date("1997-04-21T00:00:00Z"),
     Website: "https://www.google.com/"
   },
  ]
4

1 回答 1

3

可以通过使用单元格模板在 igxCell 中添加超链接:

<igx-column field="Website" header="Website" [dataType]="'string'" [minWidth]='"200px"'>
    <ng-template igxCell let-cell="cell">
        <a class="truncate" href="{{cell.value}}" target="_blank">{{cell.value}}</a>
    </ng-template>
</igx-column>

在这里,您可以找到演示如何实现所需行为的 stackblitz 示例。

此外,所有 IgxCell 的属性都在此处的 Infragistics 文档中列出,有关 IgxColumnComponent 的更多信息可以在此处找到。

于 2021-03-05T16:59:05.103 回答