Angular 如何在swimlane ngx datatable中显示自定义格式的嵌套键

Angular 如何在swimlane ngx datatable中显示自定义格式的嵌套键,angular,datatable,ngx-datatable,Angular,Datatable,Ngx Datatable,如何在行中显示自定义计算? 如果我想对价格收取费用怎么办 { prop: order.product.price } 我想我需要访问行中的其他值。使用ng template。例如: { prop: 'order.product.price + order.fee' } {{order.product.price+order.fee} 我没有测试您的特定代码,但这是一种方法。尝试一下,并按照您的要求采用它 有关更多信息: 使用ng模板。例如: { prop: 'order.product

如何在行中显示自定义计算? 如果我想对价格收取费用怎么办

{ prop: order.product.price }

我想我需要访问行中的其他值。

使用
ng template
。例如:

{ prop: 'order.product.price + order.fee' }

{{order.product.price+order.fee}
我没有测试您的特定代码,但这是一种方法。尝试一下,并按照您的要求采用它

有关更多信息:


使用
ng模板
。例如:

{ prop: 'order.product.price + order.fee' }

{{order.product.price+order.fee}
我没有测试您的特定代码,但这是一种方法。尝试一下,并按照您的要求采用它

有关更多信息:


不幸的是,ngx数据表似乎受到其prop字段的限制,因为它不进行计算。我个人是利用这个机会来解决这个问题的。在你的情况下,可能是这样的

     <ngx-datatable-column name="Order Price+Fee">
        <ng-template let-row="order" ngx-datatable-cell-template>
          <div>{{order.product.price + order.fee}}</div>
        </ng-template>
      </ngx-datatable-column>

如果你觉得那很麻烦,那我们两个就成了

不幸的是,ngx datatable似乎受到其prop字段的限制,因为它不需要计算。我个人是利用这个机会来解决这个问题的。在你的情况下,可能是这样的

     <ngx-datatable-column name="Order Price+Fee">
        <ng-template let-row="order" ngx-datatable-cell-template>
          <div>{{order.product.price + order.fee}}</div>
        </ng-template>
      </ngx-datatable-column>
如果你觉得那很麻烦,那我们两个就成了