Members
-
events :Object|Object
-
Details
-
bindings :Object
-
Details
-
<private> cellContainerId
-
-
<private> cellsContainerId
-
-
<private> cellTemplate
-
-
<private> cellViewInstances
-
-
<private> collection
-
-
<private> rowsContainerId
-
-
<private> rowsCount
-
-
<abstract, protected> template
-
Description
The template you want to use to display the collection of elements. The HTML returned by the template must contain a HTML tag with the following data attribute:
data-type="backbone.collection.view.rows"
. The data attribute is typically used with a DIV tag, but it does not necessarily have to be a DIV tag. When the template is rendered, the element with the data attribute is replaced with the view content (rows and cells).Note:
template
is an abstract property; you must override it in your child class 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
Details
-
getContext() → {Object}
-
Description
Returns the object which will be consumed by this view's template
Returns
Details
-
extend( view_definition )
-
Parameters
Name Type Description view_definition
View an object with some of this class members.
Details
-
<private> appendCellsToRow()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
<private> calculateSpanSize()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
<private> createCell()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
<private> createCellElement()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
destroy()
-
Details
-
<private> destroyCellViewInstances()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
<abstract> getCellViewInstance( element, index ) → {SCView}
-
Description
Returns an instance of a cell view, which is used to render a cell in a row in the grid. This method is called once for each element in the array passed to SCCollectionView. When the page is rendered, each element is displayed in the cell. The returned cell view instance must extend SCView.
getCellViewInstance
is an abstract method; you must override it in your child class object. It must return an instance of a cell view.Parameters
Name Type Description element
TCollectionElement An element of the array passed to the class contructor.
TCollectionElement
is the type of the element passed in the array.index
Number The position of the cell in the array.
Returns
-
<protected> getCellViewsPerRow() → {Number}
-
Description
Lets you specify the number of cells to display in a row in the grid. The default number of cells displayed per row is three (3). If you override this method, it must return a positive integer.
You will only need to override this method if you override getRowViewInstance() and want to display a different number of rows.
MySCCollectionView.prototype.getCellViewsPerRow = function() { return 6; }
Returns
-
<private> getEffectiveCellViewsPerRow()
-
Description
An internal method. Do not override this method. If you override this method, your SuiteCommerce website might not work as expected.
-
<protected> getRowViewInstance( index ) → {SCView}
-
Description
Gets an instance of a row view. The render() method uses
getRowViewInstance()
to display a row on the page. You can override this method in your child class to define the view that wraps the cell views (defined with getCellViewsPerRow()). If you override this method, it must return an instance of an SCView child class.The template of the view instance returned by this method must have a HTML tag with the attribute: data-type="backbone.collection.view.cells". For example,
<div data-type="backbone.collection.view.cells"></div>
.Note: If you override this method, and you do not want to display the default number of cells per row (3), you will also need to override getCellViewsPerRow().
Parameters
Name Type Description index
Number The number of the row being rendered. Rows are zero-based.
Returns
-
render()
-
Details