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
- SC.SelectionSupport.allowsEmptySelection
- SC.SelectionSupport.allowsMultipleSelection
- SC.SelectionSupport.allowsSelection
- SC.SelectionSupport.hasSelectionSupport
Class Methods
- deselectObject(object)
- deselectObjects(objects)
- firstSelectableObject()
- hasSelection()
- selection(key, value)
- selectObject(object, extend)
- selectObjects(objects, extend)
- updateSelectionAfterContentChange()
Field Detail
SC.SelectionSupport.allowsEmptySelection BooleanClass Method Detail
- Parameters:
- objects SC.Enumerable
- objects to select
- Returns:
- Object
- receiver
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
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
Selects a single passed object in your content. If you set "extend" to
YES
then this will attempt to extend your selection as well.
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
Call this method whenever your source content changes to ensure the selection always remains up-to-date and valid.
- Returns:
- Object