0
marioette compositeView를 사용하여 트리 테이블 구성 요소를 작성하려고했습니다.트리 모델 데이터의 깊이 가져 오기 - 합성보기 - marionettejs
this과 유사합니다.
marioettejs를 사용하여 트리 메뉴를 작성하려면 Derick's sample을 참조해야합니다.
// The recursive tree view
var TreeView = Backbone.Marionette.CompositeView.extend({
template: "#node-template",
tagName: "ul",
initialize: function(){
this.collection = this.model.nodes;
}
});
// The tree's root: a simple collection view that renders
// a recursive tree structure for each item in the collection
var TreeRoot = Backbone.Marionette.CollectionView.extend({
childView: TreeView
});
UnOrder 목록 대신 Table을 사용하려고했는데 트리 깊이에 따라 각 TR에 CSS 클래스를 적용했습니다.
하지만 여기서는 렌더링하는 동안 모델의 깊이를 얻기위한 API를 찾을 수 없습니다. 재귀 호출 중에 깊이를 얻을 수있는 방법이 있습니까?