2

I have a collection view with the followig code:

class FoosCollectionView extends Backbone.View
  el: '#foos'

  initialize: ->
    @collection = new FoosCollection [],
      barId: @options.barId
      foozId: @options.foozId

    @listenTo @collection, 'sync', @render
    @collection.fetch()

  template: MyApp.Templates.foos

  render: (event)->
    $(@el).html @template @collection
    @

FoosCollectionView

Before Backbone 1.0.0 a reset event was triggered when fetch on a collection completed. Now the sync event is triggered, but I dont know if this is due to a bug or if it is new standard behaviour.

Can anyone tell me, why reset is not triggered anymore?

Regards Felix

4

1 回答 1

7

In the 1.0.0 changelog, I see:

Renamed Collection's "update" to set, for parallelism with the similar model.set(), and contrast with reset. It's now the default updating mechanism after a fetch. If you'd like to continue using "reset", pass {reset: true}.

于 2013-03-30T12:26:16.507 回答