I am attached to some events in renderthe backbone.js function, more specifically a click, however I cannot get it to work.
I have a similar (but very simplified) setup:
App.ProductView = Backbone.View.extend({
className: 'title_products_tab',
el: $('.title_products_tab'),
events: {
'click .product_list .edit_product' : 'edit',
In the events section of my spine. Inside the render function, I want to trigger an event .edit_product click:
render: function(){
console.log($._data( $('.title_products_tab .product_list .edit_product')[0], "events" ));
$('.title_products_tab .product_list .edit_product').trigger('click');
Which does not work _datafor the undefined element, however, I know that this event works because the rest of my view functions accordingly. I just can't fire events in renderor anywhere else on startup.
I thought:
this.trigger('click .product_list .edit_product');
Will work, again, no luck.
I also heard about bindAll, but I heard that this is not a good idea.
, , , ?