2

I would like to add a custom row at the bottom of an ember-table so that it will allow the user to insert new rows to the table. Which approach should I take? The idea is similar to the one asked here but using a fixed row and ember-table.

4

1 回答 1

0

我建议扩展 Ember Table 以覆盖footerContent

import Ember from 'ember';
import TableComponent from 'ember-table/components/ember-table';
MyTable = TableComponent.extend({
  footerContent: ...
});

然后,您将Ember.Table.Row使用自定义行覆盖,并将其放入footerContent. 您可以在该行上定义一个额外的操作,该操作获取该行的数据并将其添加到content支持主表中。(您需要将引用传递content到您的自定义行中)。

您可以通过覆盖来做同样的事情bodyContent,但我认为使用页脚非常适合此目的,而且我越来越认为覆盖bodyContent是一个坏主意。

于 2015-05-26T00:45:43.637 回答