Skip to content

Instantly share code, notes, and snippets.

@gillesruppert
Created June 27, 2013 10:44
Show Gist options
  • Save gillesruppert/5875554 to your computer and use it in GitHub Desktop.
Save gillesruppert/5875554 to your computer and use it in GitHub Desktop.
Marionette.CollectionView for a select box
<select> // CollectionView.el
<option value="modelId">Model.name</option> // ItemView for the model
</select>
<!--
can you have Marionette views that do not have a template without overriding the render method? Overriding the render method is painful as you have to implement the `isClosed setting plus all the event triggers, so it keeps working with all the Marionette hooks, or am I mistaken?
-->
@kyanny
Copy link

kyanny commented Apr 9, 2015

Same solution, well explained. http://stackoverflow.com/a/18194457/374851

An ItemView can take a collection in to it, and you can access that collection at items inside of the template.

and it's written in document too.
https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.itemview.md#rendering-a-collection-in-an-itemview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment