Mixin: SC.SelectionSupport

Implements common selection management properties for controllers.

Selection can be managed by any controller in your applications. This mixin provides some common management features you might want such as disabling selection, or restricting empty or multiple selections.

To use this mixin, simply add it to any controller you want to manage selection and call updateSelectionAfterContentChange() whenever your source content changes. You can also override the properties defined below to configure how the selection management will treat your content.

This mixin assumes the arrangedObjects property will return an SC.Array of content you want the selection to reflect.

Add this mixin to any controller you want to manage selection. It is already applied to SC.ArrayController.

Defined in: selection_support.js

Since:
SproutCore 1.0

Field Summary

Class Methods

Field Detail

SC.SelectionSupport.allowsEmptySelection Boolean
If YES, allow empty selection Default is YES.
SC.SelectionSupport.allowsMultipleSelection Boolean
If YES, multiple selection is allowed. Default is YES.
SC.SelectionSupport.allowsSelection Boolean
If YES, selection is allowed. Default is YES.
SC.SelectionSupport.hasSelectionSupport Boolean
Walk like a duck.

Class Method Detail

deselectObject(object)
Deselects the passed object in your content.
Parameters:
object SC.Object
single object to select
Returns:
Object
receiver
deselectObjects(objects)
Deselects the passed objects in your content.
Parameters:
objects SC.Enumerable
objects to select
Returns:
Object
receiver
firstSelectableObject()

Override to return the first selectable object. For example, if you have groups or want to otherwise limit the kinds of objects that can be selected.

the default implementation returns firstObject property.

Returns:
Object
first selectable object
hasSelection()
YES if the receiver currently has a non-zero selection.
selection(key, value)

This is the current selection. You can make this selection and another controller's selection work in concert by binding them together. You generally have a master selection that relays changes TO all the others.

Parameters:
key
value
selectObject(object, extend)

Selects a single passed object in your content. If you set "extend" to YES then this will attempt to extend your selection as well.

Parameters:
object Object
object to select
extend Boolean
optionally set to YES to extend selection
Returns:
Object
receiver
selectObjects(objects, extend)

Selects the passed objects in your content. If you set "extend" to YES, then this will attempt to extend your selection as well.

Parameters:
objects SC.Enumerable
objects to select
extend Boolean
optionally set to YES to extend selection
Returns:
Object
receiver
updateSelectionAfterContentChange()

Call this method whenever your source content changes to ensure the selection always remains up-to-date and valid.

Returns:
Object
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)