0

我正在生成这样的表:

<div class="table zebra-striped selectable">
    {{#each "App.accidentsController.content"}}
        {{view App.AccidentView contentBinding="this"}}
    {{/each}}
</div>

App.AccidentView像这样的东西在哪里:

<div {{action tbodyClick this target='this'}} class="tr accident">
    <div class="td w03pr">{{unbound [1]}}</div>
    <div class="td">{{unbound [3]}}</div>
    <div class="td">{{unbound [4]}}</div>
</div>

我正在考虑性能问题,因为行数可能有数百甚至数千,所以我没有对行使用绑定,目前没有ContainerView认真考虑(或者我应该考虑吗?)。在我处理了行数据之后,我只想替换所有行的 html。我有一个行模板和它的上下文,我认为最简单有效的方法就是用新的行替换一行 html,我可以按照文档执行如下操作:

var newView=App.AccidentView.create(newContext);
newView.appendTo('div.table');

append还不够,我需要放置它而不是旧行——比如 jQuery 的 replaceWith。所以我的问题是这样做的正确方法是什么 - 以某种方式修剪tr视图或使用的标签,ContainerView但是性能呢?感谢您的任何见解。

4

0 回答 0