Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hcliff/2932520 to your computer and use it in GitHub Desktop.
Save hcliff/2932520 to your computer and use it in GitHub Desktop.
class Example.Views.Table extends Backbone.View
template: JST['example/table']
initialize: ->
@collection.on 'add', @addOne
render: ->
@$el.html @template()
@addAll()
@
_addOne: (person) ->
view = new Example.Views.Row model: person
view.render().el
addOne: (person) =>
@$el.append @_.addOne(person)
addAll: ->
@$el.html @collection.map(@_addOne)
class Example.Views.Row extends Backbone.View
template: JST['example/row']
render: ->
@$el.html @template @model
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment