From the course: Learning Backbone.js
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating a collection view - Backbone.js Tutorial
From the course: Learning Backbone.js
Creating a collection view
With the single model view done, it's time to create the collection view. The collection view syntax will be similar to the model view syntax, although the property definitions will be different, as will the render functionality. We'll also be creating a custom function instead of using one that comes with Backbone. So, let's go back to snippets.txt. And, I'm going to highlight and copy the lines 75 through 84, copy those, and go back to allFlowersView.js, and paste them at the top. Again, my code gets namespace on line two, and on line four I'm creating a variable called app.FlowersView, and using it to create a brand new view with, backbone.view.extend. I wanted to find a tag name for this so back to snippets.txt, scroll down a little bit, copy the code that's on line 90, highlight it and copy it. Back to allFlowersView, and I'm going to paste this code inside of my allFlowers object. Here we go. So the collection needs a web page element assigned to it. This collection element will…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.