Reputation: 13420
I am wondering why _.bindAll(this, ['onSortRemove']);
in the following code (1) rises the following error:
Uncaught TypeError: Object [object Window] has no method 'resetItemViewContainer'
To get things working I need to implement the following code _.bindAll(this);
.
My question is: should _.bindAll(this, ['onSortRemove']);
be enough? if not, why?
(1)
initialize: function () {
_.bindAll(this, ['onSortRemove']); // it does not work
_.bindAll(this); // it works
}
onSortRemove: function () {
setTimeout(this.render, 0);
}
Upvotes: 0
Views: 609
Reputation: 72878
Syntax error
initialize: function () {
_.bindAll(this, 'onSortRemove'); // <- no array wrapper
}
The documentation's syntax of [*methodnames]
is not saying "wrap this in an array". That's old-school documentation style to say "method names is optional, it can be zero or more arguments, comma-delimited".
Upvotes: 2