Add child view and pass model to child view

'use strict';
		var sample;

		return {
			mountToApp: function mountToApp(container) {
				// using the 'Layout' component we add a new child view inside the 'Header' existing view 
				// (there will be a DOM element with the HTML attribute data-view="Header.Logo")
				// more documentation of the Extensibility API in
				// https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/index.html

				/** @type {LayoutComponent} */
				var Layout = container.getComponent('Layout');

				var showConversion = container.getConfig().get('annexaUOM.showconversion');
				var activateUOM = container.getConfig().get('annexaUOM.enableUOM');


				if (!activateUOM) return;

				_.extend(ProductListDetailsView.prototype, {

					initialize: _.wrap(ProductListDetailsView.prototype.initialize, function wrapInitialice(fn) {
						fn.apply(this, _.toArray(arguments).slice(1));

					

						var self = this;
						sample = self.model;

						
					}),

				});

				Layout.addChildView('Option.Collection', function () {
					console.log("item model", sample)
					console.log("Layout", Layout)
					return new WishListUOMView({
						application: Layout.application,
						container: container,
						layout: Layout,
						model: sample
					});
				});
				


			}
		};
	});

Leave a comment

Your email address will not be published. Required fields are marked *