I am trying to reset my collection without triggering the 'reset' event. I have set up my collection to listen to both 'reset' and 'add' events
@.listenTo(@options.muses, 'add', @addOne)
@.listenTo(@options.muses, 'reset', @addAll)
When I click on a button, the first thing I want to do is to clear out the collection
optionButtonClicked: (e) ->
e.preventDefault()
target = @$(e.currentTarget)
//step to clear out the collection
@options.muses.reset({silent:true})
However when I did some logging and checking, I realize that the 'reset' event was still being triggered i.e. the @addAll function was still being called.
Am I missing something here? Isn't silent:true supposed to suppress the reset event?
reset takes two optional parameters, models 1st, options 2nd. From the docs: resetcollection.reset([models], [options])
.
so you need to pass in the silent option as the second parameter.
@options.muses.reset(undefined, {silent:true});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With