좀비보기를 처리하기 위해 백본 지원을 처음 사용했습니다. 파이어 폭스와백본 지원 중첩보기 및 Chrome
this.$el.append(this.template());
// this view fills up a select with options taken from a web services
this.renderChildInto(new App.view.ResourcesView({name: "idActivityDesc", url: "/wfc-services/resources/activities"}), "#divIdActivityDesc");
// population of the forms elements according to the loaded model
this.populateSelectElements();
this.populateTextElements();
if(this.model.get('completed')) {
this.$("#active").removeAttr("disabled");
}
this.delegateEvents(this.events);
return this;
는 모든 작업 괜찮아요 : 그것을 소개하기 전에, 나는 다음과 같은 문제가 발생하지 않았다. 모델이 비어있는 경우 select
요소가 기본 요소로 설정됩니다. 내 경우에는 selectedIndex to -1입니다.
보기 내부에서 디버그를하면 모든 것이 잘된 것처럼 보입니다. 보기가 부모에게 방법 renderChildInto
을 통해 일어날 때 문제가 있습니다. dom은 괜찮지 만 모델이 비어있는 경우 populateSelectElements()
에서 파생 된 변경 사항은 없습니다. 비어 있지 않으면 문제가 없으며보기가 정상적으로 작동합니다. return this;
문 앞에, 심지어 크롬/크롬에서 내가 -1에 selectedIndex의를보기 때문에
난 정말 그것에 대해 의아해 해요. 그러나 브라우저의 최종 렌더링 된 뷰에서 선택 항목은 ~ 입니다.
는 composite_view.js에서 호출 된 코드는 다음과 같습니다
renderChild: function(view) {
view.render();
this.children.push(view);
view.parent = this;
},
renderChildInto: function(view, container) {
this.renderChild(view);
this.$(container).html(view.el);
},