Created
November 25, 2013 16:07
-
-
Save headwinds/7643781 to your computer and use it in GitHub Desktop.
a sample from my tutorial on the Marionette CollectionView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see https://github.com/headwinds/tutorials/tree/master/marionettejs/marionettejs-collection-view | |
define([ | |
'underscore', | |
'backbone', | |
'marionette', | |
'views/user/UserItemView', | |
'models/user/UserModel', | |
'collections/user/UserCollection' | |
], function(_, Backbone, Marionette, UserItemView, UserModel, UserCollection ) { | |
var UserCollectionView = Backbone.Marionette.CollectionView.extend({ | |
el: "#users", | |
tagName: "tbody", | |
itemView: UserItemView, | |
onAfterItemAdded: function(itemView){ | |
//console.log(itemView.model, "UserCollectionView - item was added"); | |
}, | |
onRender: function(){ | |
var that = this; | |
that.children.each(function(view){ | |
// you can also loop through items here... | |
}); | |
} | |
}); | |
return UserCollectionView; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment