Answer the question
In order to leave comments, you need to log in
How to display collection?
Help bring collections.
There is a model:
define([
'backbone.marionette'
],
function (Marionette) {
return Backbone.Model.extend({
defaults: {
id: '',
name: 'Отчёт',
number: ''
}
});
});
define([
'backbone.marionette',
'models/report-link'
],
function (Marionette, ReportLinkModel) {
return Backbone.Collection.extend({
model: ReportLinkModel
});
});
define([
'underscore',
'backbone.marionette',
'models/report-link',
'text!templates/tables/reportLink.hbs'
],
function (_, Marionette, ReportLinkModel, ReportLinkTpl) {
return Backbone.Marionette.ItemView.extend({
template: _.template(ReportLinkTpl),
tagName: 'li',
model: new ReportLinkModel,
initialize: function () {
this.render();
}
});
});
define([
'backbone.marionette',
'views/item/report-link',
'collections/report-links'
],
function (Marionette, ReportLinkItemView, ReportLinkCollection) {
return Backbone.Marionette.CollectionView.extend({
childView: new ReportLinkItemView,
collection: new ReportLinkCollection({id: '1', name: 'Отчёт', number: '1'}),
tagName: 'ul',
initialize: function () {
this.render();
console.log(this.collection)
}
});
});
new ReportLinkCollectionView;
TypeError: t is not a constructor
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question