In my backbone function, i have no.of filter methods, so i decided to instead using ‘this.$el.append()’, ‘this.$el.html()’ – but the replacing html() is not working. i thought i would be fine to repalce hole view with new collections.
as well it tried to make the this.$el.empty(), but not works… so how can i clear the existing element from the parent, and append the new generation elements..?
my code :
renderBoard:function(item){
var singleView = new taskListPhraseI.oneView({model:item}),
// after this, i need to make parent of the element should be empty...
board = this.$el.append(singleView.render()),
newBoard = board.find('.indBoard:last');
this.positionBoards(newBoard);
},
how can i achieve this?
So if you have your view setup as follows
then when your rendering your view and want to remove all other views before hand, it’d go something like
If you’re still having trouble, maybe ‘this’ has lost context, and no longer refers to your class, i’d debug what the value of that is when you are rendering.
Hope that helps