我在 typescript 12 中使用角度 Infragistics UI 网格
当网格处于分组模式时,我正在尝试计算价格字段的总和。假设我有 2 个客户组,第 1 组包含 2 个项目,第 2 组包含 3 个项目。我必须得到每个分组客户的总价(例如 group1 为 300,第二个为 800)。
这是我在 HTML 组件中的代码
<igx-grid #grid id="grid" [data]="listeinvoices" [groupingExpressions]='expr' [allowFiltering]="true" [autoGenerate]="false" height="500px">
<igx-column field="client" header="client" [groupable]="true"></igx-column>
<igx-column field="price" header="price" [groupable]="true"></igx-column>
<igx-column field="invoicenumber" header="invoice nb" [groupable]="true"></igx-column>
</igx-grid>
ts组件的代码:
export class FactureComponent implements OnInit {
public expr: ISortingExpression[];
@ViewChild("grid") public grid!: IgxGridComponent;
constructor(private rest: RestService,private toastr: ToastrService,private excelExportService: IgxExcelExporterService)
{
this.expr = [
{ dir: SortingDirection.Asc, fieldName: 'client', ignoreCase: false,
strategy: DefaultSortingStrategy.instance() },
];
}
}