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
- classNames
- contentCheckboxKey
- contentIconKey
- contentIndex
- contentIsBranchKey
- contentIsEditable
- contentRightIconKey
- contentUnreadCountKey
- contentValueKey
- disclosureState
- displayProperties
- escapeHTML
- hasContentBranch
- hasContentIcon
- hasContentRightIcon
- icon
- inlineEditorDelegate
- isDropTarget
- isReusable
- outlineIndent
- outlineLevel
- rightIcon
- validator
- 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
- $label()
- beginEditing(original, scrollIfNeeded)
- inlineEditorWillBeginEditing(editor, editable, value)
Field Detail
classNames Array- Default value:
- ['sc-list-item-view']
- See:
- SC.View#classNames
(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
(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
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
(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
Determines if content is editable or not. Checkboxes and other related components will render disabled if an item is not editable.
(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
(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
(displayDelegate) The name of the property used for label itself
If null, then the content object itself will be used..
- Default value:
- null
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
- Default value:
- ['disclosureState', 'escapeHTML']
- See:
- SC.View#displayProperties
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
(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
(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
(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
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
- Default value:
- SC.InlineTextFieldDelegate
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
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
- Default value:
- 0
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
The validator to use for the inline text field created when the list item is edited.
Instance Method Detail
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
- Parameters:
- original
- scrollIfNeeded
- Parameters:
- editor
- editable
- value