new View()

Description

Subset of SuiteCommerce View exposed for Extensions developers for declaring new views, adding child-views, etc.

Internally is implemented with Backbone.View which is enhanced with handlebars templates, render plugins, context,
SEO, composition, navigation, etc.

Details

true

Members


template :function|String

Description

The template for this view, in general a function that accepts this view context object and returns an HTML string.
If it is a string an AMD module with that name is tried to be loaded.
If it is undefined the view will be rendered without errors as an empty string


events :Object|Object


bindings :Object

Methods


initialize( ...options ) → {void}

Description

this is executed when a new view is instantiated - equivalent to the instance contructor.

Parameters
Name Type Attributes Description
options any <repeatable>
Returns

render() → {void}

Description

Generates the HTML of the page.

Returns

getContext() → {Object}

Description

Returns the object which will be consumed by this view's template

Returns

destroy() → {void}

Description

Removes the view from the DOM, as well as all events associated with it. If you override this method, make sure you call the parent class immediately in the child class.

You should call this method in your child class when you want to do additional work at the time the view is destroyed. For example, if you add JQuery events in a view, you will need to stop listening for those same events when the view is destroyed.

			function CardsView() {
				//... 
			
				function destroy() {
					View.call(this);
			
					// Do other stuff here. For example, stop listening to events...
				}
			}
			
Returns

extend( view_definition )

Parameters
Name Type Description
view_definition View

an object with some of this class members.