Christopher Dembek
03/09/2021, 6:24 PMjQuery.Deferred exception: a is undefined _CmsViewPromises/<@https://mycustomwebsite.website.com/scs/javascript/shopping.js?t=1612980274111:1:649534
Steve Goldberg
03/09/2021, 6:30 PMbeforeShowContent
when using the PageTypeBaseView class
2. The CMS is usually the last thing to load, so probably not. You would need to look at the code it's pointing to figure out exactly what's going wrongChristopher Dembek
03/09/2021, 7:29 PMbeforeShowContent
and I am still getting the error.
return {
mountToApp: function (container) {
var PageType = container.getComponent('PageType'),
environment = container.getComponent('Environment');
PageType.registerPageType({
name: 'pro_program_application',
routes: ['pro-program'],
view: ProProgramApplicationView,
options: {
container: container,
environment: environment
},
defaultTemplate: {
name: 'pro_program_application.tpl',
displayName: 'Pro Program Application'
}
});
}
};
return PageTypeBaseView.PageTypeBaseView.extend({
template: program_application_tpl,
initialize: function initialize(options) {
this.model = new ApplicationModel();
},
beforeShowContent: function beforeShowContent() {
// breadcrumbs - hide
this.getBreadcrumbPages = '';
// page title
this.title = Utils.translate('Ralph Brothers Pro Program');
// add child view
// this.childViews = {
// 'ProProgramApplication.Form.View': function () {
// return new ProProgramApplicationFormView({
// container: this.options.application,
// environment: this.options.environment,
// model: this.model
// });
// }
// };
}
});
Steve Goldberg
03/09/2021, 7:31 PMbeforeShowContent()
needs to return a promise objectSteve Goldberg
03/09/2021, 7:32 PMChristopher Dembek
03/09/2021, 7:32 PMSteve Goldberg
03/09/2021, 7:32 PMChristopher Dembek
03/09/2021, 7:35 PMthis.getBreadcrumbPages
correct? We do not need to display breadcrumbs.Steve Goldberg
03/09/2021, 7:43 PMChristopher Dembek
03/09/2021, 7:46 PMreturn PageTypeBaseView.PageTypeBaseView.extend({
template: pro_program_application_tpl,
initialize: function initialize(options) {
this.model = new ProProgramApplicationModel();
},
beforeShowContent: function () {
promise = JQuery.Deferred();
// page title
this.title = Utils.translate('Ralph Brothers Pro Program');
// add child view
this.childViews = {
'ProProgramApplication.Form.View': function () {
return new ProProgramApplicationFormView({
container: this.options.application,
environment: this.options.environment,
model: this.model
});
}
};
promise.resolve();
return promise;
}
});
Steve Goldberg
03/09/2021, 7:59 PM// Your code
promise = JQuery.Deferred();
// Should probably be
var promise = new jQuery.Deferred();
Steve Goldberg
03/09/2021, 8:00 PMreturn new jQuery.Deferred().resolve();
Steve Goldberg
03/09/2021, 8:04 PMChristopher Dembek
03/09/2021, 8:04 PMExample.UserPreferences.List.View.js
did not include the jQuery.Deferred() because of the collection fetch, which I believe returns a promise.resolve()?
beforeShowContent: function beforeShowContent() {
this.getBreadcrumbPages = function () {
return [{
text: Utils.translate('User Preferences'),
href: '/preferences'
}];
};
this.title = Utils.translate('User Preferences');
this.childViews = {
'Example.UserPreferences.Collection.View': function () {
return new ExampleUserPreferencesCollectionView({
collection: this.collection
});
}
};
return this.collection.fetch();
}
Steve Goldberg
03/09/2021, 8:05 PMChristopher Dembek
03/09/2021, 8:12 PMthis.getBreadcrumbPages = ''
in the beforeShowContent, the breadcrumb view displays with “home”.