Answer the question
In order to leave comments, you need to log in
How to nest one Marionette.ItemView within another?
There is a Marionette.CompositeView and a nested Marionette.ItemView. The Marionette.ItemView model has a nested array, which must also be displayed as a child (in the form of a tree or a table). How to organize this nesting? This frame is used for the first time.
var ItemView = Marionette.LayoutView.extend({
tagName: 'tr',
template: ItemTemplate,
regions: {
footer: "#content"
},
templateHelpers: function () {
var model = this.model;
var numberFunc = this.numberFormatter;
var dateFunc = this.dateFormatter;
return {
USER_NAME: model.get('USER_NAME'),
TMC_TYPE_NAME: model.get('TMC_TYPE_NAME'),
DISMISS_COUNT: model.get('DISMISS_COUNT'),
CULTURE_NAME: model.get('CULTURE_NAME'),
DATE: dateFunc(model.get('DATE')),
};
}
});
var ConfirmView = Marionette.CompositeView.extend({
childView: ItemView,
childViewContainer: "tbody",
className: 'historyItem',
emptyView: EmptyView,
template: TemplateTable,
});
return ConfirmView;
<td> <div class ="tmcItem"><%= USER_NAME %></div></td>
<td ><div class ="tmcItem"><%= TMC_TYPE_NAME %></div></td>
<td ><div class ="tmcItem"><%= DISMISS_COUNT %></div></td>
<td ><div class ="tmcItem"><%= CULTURE_NAME %></div></td>
<td ><div class ="tmcItem"><%= DATE %></div></td>
Answer the question
In order to leave comments, you need to log in
Are you apparently using Marionette v2?
Marionette.ItemView replace Marionette.LayoutView and render the collection to the region. In general, everything is detailed in the documentation and with examples marionettejs.com/docs/v2.4.7/marionette.layoutview...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question