2
在我看來,我有以下綁定:事件
events:
{
'click #showallconsumers': 'showAllConsumers',
'submit form': 'submit',
'click #allconsumerstable tbody tr': 'selectConsumer',
},
在showAllConsumers功能,我需要在#showallconsumers錨禁用點擊,獲取收集和重新綁定點擊#showconsumers事件取完之後。
showAllConsumers: function()
{
$(this.el).undelegate('#showallconsumers', 'click');
this.collection.fetch(({async: true, success : this.renderAllConsumers}));
},
renderAllConsumers: function(collection)
{
//i'm populating table with data from collection
$('#showallconsumers').bind('click', this.showAllConsumers);
},
當我點擊#showallconsumers錨,undelegate的作品,但結束時獲取,.bind(...)不能重新綁定事件。我也試過.delegate(...)。
非常感謝你 –