Mixin: SC.CollectionContent
This mixin provides standard methods used by a CollectionView to provide additional meta-data about content in a collection view such as selection or enabled state.
You can apply this mixin to a class that you set as a delegate or to the object you set as content.
Defined in: collection_content.js
- Since:
- SproutCore 1.0
Field Summary
- SC.CollectionContent.isCollectionContent
Class Methods
- contentGroupIndexes(collection, content)
- contentIndexCollapse(collection, content, idx)
- contentIndexDisclosureState(collection, content, idx)
- contentIndexExpand(collection, content, idx)
- contentIndexIsEnabled(collection, content, idx)
- contentIndexIsGroup(collection, content, idx)
- contentIndexIsSelected(collection, content, idx)
- contentIndexOutlineLevel(collection, content, idx)
Field Detail
SC.CollectionContent.isCollectionContent BooleanClass Method Detail
Optionally return an index set containing the indexes that may be group
views. For each group view, the delegate will actually be asked to
confirm the view is a group using the contentIndexIsGroup
() method.
If grouping is not enabled, return null.
- Parameters:
- collection SC.CollectionView
- the calling view
- content SC.Array
- the content object
- Returns:
- SC.IndexSet
Called to collapse a content index item if it is currently in an open disclosure state. The default implementation does nothing.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- void
Returns a constant indicating the disclosure state of the item. Must be
one of SC.BRANCH_OPEN
, SC.BRANCH_CLOSED
, SC.LEAF_NODE.
If you return one
of the BRANCH options then the item may be rendered with a disclosure
triangle open or closed. If you return SC.LEAF_NODe
then the item will
be rendered as a leaf node.
Default returns SC.LEAF_NODE.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- Boolean
- YES, NO, or SC.MIXED_STATE
Called to expand a content index item if it is currently in a closed disclosure state. The default implementation does nothing.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- void
Returns YES
if the content index should be enabled. Default looks at the
isEnabled
state of the collection view.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- Boolean
- YES, NO, or SC.MIXED_STATE
Returns YES
if the item at the specified content index should be rendered
using the groupExampleView
instead of the regular exampleView
. Note that
a group view is different from a branch/leaf view. Group views often
appear with different layout and a different look and feel.
Default always returns NO
.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- Boolean
- YES, NO, or SC.MIXED_STATE
Return YES
if the content index should be selected. Default behavior
looks at the selection property on the view.
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- Boolean
- YES, NO, or SC.MIXED_STATE
Returns the outline level for the item at the specified index. Can be used to display hierarchical lists.
Default always returns -1 (no outline).
- Parameters:
- collection SC.CollectionView
- the collection view
- content SC.Array
- the content object
- idx Number
- the content index
- Returns:
- Boolean
- YES, NO, or SC.MIXED_STATE