【发布时间】:2013-09-02 20:17:59
【问题描述】:
我有一个非常简单的页面,在表格中显示了一个集合。在其上方有一个搜索字段,用户可以在其中输入用户的名字。
当用户键入时我想过滤列表。
编辑:我更新了代码以显示当前的复合视图是如何工作的。我的目标是集成一个可以 _.filter 集合并希望只更新集合表的 searchView。
define([
'marionette',
'text!app/views/templates/user/list.html',
'app/collections/users',
'app/views/user/row'
],
function (Marionette, Template, Users, User) {
"use strict"
return Backbone.Marionette.CompositeView.extend({
template: Template,
itemView: User,
itemViewContainer: "tbody",
initialize: function() {
this.collection = new Users()
this.collection.fetch()
}
})
})
【问题讨论】:
-
为什么不从模板中移出
#search-users-entry,这样它就不会被重新渲染? -
中肯的建议,谢谢