Skip to content

Instantly share code, notes, and snippets.

@yevgenko
Created May 13, 2015 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevgenko/2a729ee83e11fe5277a0 to your computer and use it in GitHub Desktop.
Save yevgenko/2a729ee83e11fe5277a0 to your computer and use it in GitHub Desktop.
<header>
<script type="text/html" id="options-template">
<% for (i = 0; i < items.length; i++) { %>
<option value="<%= items[i].id %>"><%= items[i].value %></option>
<% } %>
</script>
</header>
var SelectView = Marionette.ItemView.extend({
template: "#options-template",
tagName: "select",
events: {
'change' : 'optionSelected'
},
optionSelected: function(e){
this.trigger('item:chosen', this.collection.get(e.target.value));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment