0
내 백본 기능에는 필터 방법이 없으므로 대신 'this. $ el.append()', 'this. $ el.html()'을 사용하기로 결정했습니다. 하지만 대체 html()이 작동하지 않습니다. 나는 새로운 컬렉션으로 구멍보기를 재연하는 것이 좋을 것이라고 생각했습니다.백본이 html로 대체되지 않음
또한 $ el.empty()를 만들려고했지만 작동하지 않습니다 ... 어떻게 부모로부터 기존 요소를 지우고 새로운 생성 요소를 추가 할 수 있습니까? 내 코드는
:
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);
},
내가 어떻게 이것을 달성 할 수 있습니까? 당신이보기를 렌더링 할 때 다음
views = window.views || {};
views.ExampleView = Backbone.View.extend({
initiliaze: function(){
// do some stuff
},
render: function(){
$(this.el).html("<YOUR HTML GOES HERE></YOUR HTML GOES HERE>");
// return yourself as simple to chain access to your "el"
return this;
}
});
을 다음과 같이보기 설정을 손 전에 모든 다른 뷰를 제거하려면