Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Backbone.js 如何为木偶视图指定筛选的主干集合_Backbone.js_Marionette_Backbone Views - Fatal编程技术网

Backbone.js 如何为木偶视图指定筛选的主干集合

Backbone.js 如何为木偶视图指定筛选的主干集合,backbone.js,marionette,backbone-views,Backbone.js,Marionette,Backbone Views,我有一个木偶复合视图,显示我在应用程序启动处理程序中设置的集合: App.on('start', function() { Backbone.history.start({pushState: true}); // I load up this.appsCollection in my before:start handler var tblView = new this.appsTableView({ collection: this.appsCollection }

我有一个木偶复合视图,显示我在应用程序启动处理程序中设置的集合:

App.on('start', function() {
  Backbone.history.start({pushState: true});

  // I load up this.appsCollection in my before:start handler
  var tblView = new this.appsTableView({
    collection: this.appsCollection
  });

  this.regions.main.show(tblView);
}); 
这就像预期的一样,显示了我的整个收藏。在我的模型中,我有一个状态字段,我只想显示状态为0的模型。我试过:

collection: this.appsCollection.where({state: 0})
但这不起作用。我实际上想在0和1中显示状态,但我现在只想在0中显示状态


我缺少什么?

问题可能在于
。where()
不返回集合,而是返回数组。这应该是为了保持与下划线的兼容性

如果将行更改为:

collection: new Backbone.Collection( this.appsCollection.where( { state: 0 } ))

这有帮助吗?

问题可能在于
。where()
不返回集合,而是返回数组。这应该是为了保持与下划线的兼容性

如果将行更改为:

collection: new Backbone.Collection( this.appsCollection.where( { state: 0 } ))

这有帮助吗?

问题可能在于
。where()
不返回集合,而是返回数组。这应该是为了保持与下划线的兼容性

如果将行更改为:

collection: new Backbone.Collection( this.appsCollection.where( { state: 0 } ))

这有帮助吗?

问题可能在于
。where()
不返回集合,而是返回数组。这应该是为了保持与下划线的兼容性

如果将行更改为:

collection: new Backbone.Collection( this.appsCollection.where( { state: 0 } ))

这有帮助吗?

我能够在我的木偶合成视图中覆盖过滤方法:


我能够在我的木偶合成视图中覆盖过滤方法:


我能够在我的木偶合成视图中覆盖过滤方法:


我能够在我的木偶合成视图中覆盖过滤方法:


集合是包含大量额外方法和数据的包装数组。集合是包含大量额外方法和数据的包装数组。集合是包含大量额外方法和数据的包装数组。集合是包含大量额外方法和数据的包装数组。