【发布时间】:2019-03-07 07:59:33
【问题描述】:
我正在尝试通过执行以下操作来制作我认为的简单表格:
<GridLayout rows="auto" columns="*,*,auto" width="100%" class="table-body">
<Label col="0" row="0" text="Date"></Label>
<Label col="1" row="0" text="Previous Owner"></Label>
<Label col="2" row="0" text="Price" horizontalAlignment="center"></Label>
<template *ngFor="let sale of history; let i = index">
<Label col="0" row="{{i+1}} [text]="sale.saleDate"></Label>
<Label col="1" row="{{i+1}} [text]="sale.username"></Label>
<Label col="2" row="{{i+1}} [text]="sale.price" horizontalAlignment="center"></Label>
</template>
</GridLayout>
我要创建的表格示例:
此代码不起作用,但我认为它显示了我正在尝试做的事情,有人建议我将 *ngFor 放在 GridLayout 标记内,但这不起作用,因为它不会占用最大的sale.price 使列宽。
我很惊讶我很难找到任何例子来帮助我解决这个问题。任何帮助将不胜感激。
【问题讨论】:
标签: angular nativescript grid-layout tabular ngfor