Class: SC.ListItemView


Extends SC.Control, SC.InlineEditable, SC.View.

Many times list items need to display a lot more than just a label of text. You often need to include checkboxes, icons, right icons, extra counts and an action or warning icon to the far right.

A ListItemView can implement all of this for you in a more efficient way than you might get if you simply put together a list item on your own using views.

Defined in: list_item.js

Since:
SproutCore 1.0

Field Summary

Fields borrowed from SC.View:
acceptsFirstResponder, acceptsMultitouch, ariaHidden, ariaRole, attributeBindings, autoMixins, backgroundColor, childViewLayout, childViewLayoutOptions, childViews, childViewsNeedLayout, classNameBindings, concatenatedProperties, createdByParent, designMode, enabledState, firstKeyView, hasLayout, hasTouch, hasVisibility, isBuildingIn, isBuildingOut, isChildViewLayoutLive, isEnabled, isFixedHeight, isFixedPosition, isFixedSize, isFixedWidth, isKeyResponder, isTextSelectable, isView, isVisible, lastKeyView, layerLocationNeedsUpdate, layerNeedsUpdate, layout, modeAdjust, nextKeyView, page, pane, parentView, previousKeyView, renderDelegateName, shouldInheritCursor, shouldInheritEnabled, tagName, themeName, toolTip, touchBoundary, transitionAdjust, transitionAdjustOptions, transitionHide, transitionHideOptions, transitionIn, transitionInOptions, transitionOut, transitionOutOptions, transitionShow, transitionShowOptions, useStaticLayout
Fields borrowed from SC.Responder:
hasFirstResponder, isFirstResponder, responderContext
Fields borrowed from SC.Object:
isDestroyed, isObject, nextProperty, object, property, target, toInvalidate
Fields borrowed from SC.Observable:
isObservable
Fields borrowed from SC.Control:
controlSize, errorLabel, fieldKey, fieldLabel, isActive, isControl, isSelected

Instance Methods

Field Detail

classNames Array
Default value:
['sc-list-item-view']
See:
SC.View#classNames
contentCheckboxKey String

(displayDelegate) The name of the property used for the checkbox value.

The checkbox will only be visible if this key is not null.

Default value:
null
contentIconKey String

(displayDelegate) Property key to use for the icon url

This property will be checked on the content object to determine the icon to display. It must return either a URL or a CSS class name.

Default value:
NO
contentIndex Number

The index of the content object in the ListView to which this ListItemView belongs.

For example, if this ListItemView represents the first object in a ListView, this property would be 0.

Default value:
null
contentIsBranchKey String

(displayDelegate) The name of the property used to determine if the item is a branch or leaf (i.e. if the branch icon should be displayed to the right edge.)

If this is null, then the branch view will be completely hidden. Otherwise space will be allocated for it.

Default value:
null
contentIsEditable Boolean

Determines if content is editable or not. Checkboxes and other related components will render disabled if an item is not editable.

contentRightIconKey String

(displayDelegate) Property key to use for the right icon url

This property will be checked on the content object to determine the icon to display. It must return either a URL or a CSS class name.

Default value:
null
contentUnreadCountKey String

(displayDelegate) The name of the property used to find the count of unread items.

The count will only be visible if this property is not null and the returned value is not 0.

Default value:
null
contentValueKey String

(displayDelegate) The name of the property used for label itself

If null, then the content object itself will be used..

Default value:
null
disclosureState String

Disclosure state for this list item. Usually set by the collection view when the list item is created. Possible values:

  • SC.LEAF_NODE
  • SC.BRANCH_OPEN
  • SC.BRANCH_CLOSED
Default value:
SC.LEAF_NODE
displayProperties Array
Default value:
['disclosureState', 'escapeHTML']
See:
SC.View#displayProperties
escapeHTML Boolean

IF true, the label value will be escaped to avoid HTML injection attacks. You should only disable this option if you are sure you will only display content that is already escaped and you need the added performance gain.

Default value:
YES
hasContentBranch Boolean

(displayDelegate) True if you want space to be allocated for a branch arrow.

If false, the space for the branch arrow will be collapsed.

Default value:
NO
hasContentIcon Boolean

(displayDelegate) True if you want the item view to display an icon.

If false, the icon on the list item view will be hidden. Otherwise, space will be left for the icon next to the list item view.

Default value:
NO
hasContentRightIcon Boolean

(displayDelegate) True if you want the item view to display a right icon.

If false, the icon on the list item view will be hidden. Otherwise, space will be left for the icon next to the list item view.

Default value:
NO
icon String

The URL or CSS class name to use for the icon. This is only used if contentIconKey is null, or returns null from the delegate.

Default value:
null
inlineEditorDelegate Object
Default value:
SC.InlineTextFieldDelegate
isDropTarget Boolean

Whether this item is the drop target of a drag operation.

If the list view supports the SC.DROP_ON operation, it will set this property on whichever list item view is the current target of the drop.

When true, the 'drop-target' class is added to the element.

Default value:
false
isReusable
SC.ListItemView is not able to update itself in place at this time.
outlineIndent Number

Indent to use when rendering a list item with an outline level > 0. The left edge of the list item will be indented by this amount for each outline level.

Default value:
16
outlineLevel Number
Outline level for this list item. Usually set by the collection view.
Default value:
0
rightIcon String

The URL or CSS class name to use for the right icon. This is only used if contentRightIconKey is null, or returns null from the delegate.

Default value:
null
validator

The validator to use for the inline text field created when the list item is edited.

Instance Method Detail

$label()

Finds and retrieves the element containing the label. This is used for inline editing. The default implementation returns a CoreQuery selecting any label elements. If you override renderLabel() you probably need to override this as well.

Returns:
jQuery
jQuery object selecting label elements
beginEditing(original, scrollIfNeeded)
Parameters:
original
scrollIfNeeded
inlineEditorWillBeginEditing(editor, editable, value)
Parameters:
editor
editable
value
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)