-
Notifications
You must be signed in to change notification settings - Fork 325
Can't re-render without breaking events #71
Comments
How do you trigger a re-render and what events on which part stop working? |
For example, i do : var MyView = new Backbone.View.extend({
initialize: function () {
View.prototype.initialize.apply(this, arguments);
this.gridView = new Backgrid.Grid({
collection: this.collection,
el: '.backgrid'
});
},
render: function () {
View.prototype.render.apply(this, arguments);
this.gridView.render();
return this;
}
});
var view = new MyView();
view.render(); // events OK
view.render(); // events breaked |
What is in that ListGridView? |
ListGridView is Backgrid.Grid, sorry i made a mistake. |
I can't reproduce this from the demos. Either you show me all the relevant code or you'll have to write a failing test case to point out the error. |
I find the origin of the problem, in each render you do a
I make a fiddle to show you the problem. |
Ah thanks for catching this, I just reproduced it. No need for a fiddle anymore. |
Ok, but i have already made it http://jsfiddle.net/neoziro/WaBJF/ |
Thx. Will fix that tomorrow. |
If you need help, don't hesitate to tell me. An other solution is to always use setElement, in my projects i always include my subviews using this functions : Backbone.View.extend({
append: function (selector, view) {
this.$(selector).append(view.render().el);
view.delegateEvents();
return this;
},
assign: function (selector, view) {
view.setElement(this.$(selector)).render();
return this;
}
}); It can give you some ideas :). Thanks for the fix and for this great job ! |
I can't re-render the grid without breaking events like click on
th
to sort columns.The philosophy of Backbone is such that i can re-render several times without breaking UI.
Is there a solution ? Can you fix this ?
The text was updated successfully, but these errors were encountered: