itemViewClassBinding in a collectionView

I'm trying to create a reusable component which consist of a textfield and under the textfield, i want to have a collectionView to display a filtered list of elements.

My problem is that I want itemViewClass of the containerView to be customized when creating the component. Currently, I pass a parameter listItemView to the container view and declare itemViewClassBinding: 'parentView.listItemView' instead of having an hardcoded templates.

This leads me to a problem where Ember assert that itemViewClass must be an instance of Ember.View:

Uncaught Error: assertion failed: itemViewClass must be a subclass of Ember.View, not function () {

Did anybody ran into a similar problem?

Thank you

Answers


Sub-classing your ContainerView class is one option. Here is an example: http://jsfiddle.net/ethan_selzer/kcjzw/240/

This pastie may be a little easier to read: http://pastie.org/4256407

Ethan


I have created this functionality very recently in my ember app. The way I did it was by binding to a controller property. When the user types in the textfield it needs to set the filter text as a controller property. Then your controller will have another property that observes the filter field text property and produces a filtered list of the content data based on the filter text. Then your filtered view would be bound to that filtered content of the controller instead of the usual (all) content. This way your two views don't need to know about each other and the controller provides the data.


Need Your Help

How do I use a variable so that it is inside and outside of a function

function variables if-statement arguments python-3.4

I would like to know how I can use a variable in a function but then outside of the function as well.