How to use CollectionView in connection with connectOutlets?

I am currently trying to use CollectionView in my router and ConnectOutlets. I am fine if I use the collection view helper, but this contradicts my other implementations in which I always use connectOutlets.

I basically try:

connectOutlets : function(router){ console.log("calling connectOutlets"); router.get("applicationController").connectOutlet({ viewClass : App.ItemsView, controller : App.itemController, context : content }) } App.ItemsView = Ember.CollectionView.extend({ itemViewClass : App.ItemView, }); 

App.ItemsView is my subclass of CollectionView. App.itemController is a manually created ArrayController i. You can see the full fiddle here: http://jsfiddle.net/mavilein/qS3aN/12/

But actually it does not work. I do not see how objects are processed. It works fine with the collection assistant, but setting the binding in the view is too static for me. Is CollectionView not intended for use with connectOutlets?

+4
source share
1 answer

It seems you can do this, but in ItemsView you need to make two small settings:

 App.ItemsView = Ember.CollectionView.extend({ contentBinding: 'controller', itemViewClass : 'App.ItemView', }); 
  • Since CollectionView relies on its content, you must bind it to a property of the controller. (this property is connected at the time of connection).

  • As you define App.ItemView after ItemsView , you need to refer to it as a string to allow Ember.js to look for it while creating the ItemsView instance.

script: http://jsfiddle.net/qS3aN/29/

+4
source

All Articles