Protocol

NSOutlineViewDataSource

A set of methods that an outline view calls to retrieve data and information about it from the data source delegate, and—optionally—to update data values.

Declaration

@protocol NSOutlineViewDataSource

Overview

NSOutlineView objects support a data source delegate in addition to the regular delegate object.

All the methods in the NSOutlineViewDataSource protocol are marked as @optional. While this is true, there are cases were you must implement some methods to achieve required functionality, specifically when working with conventional data sources rather than data that is provided by Cocoa bindings.

Required and Optional Methods Using Programmatic Conventions and Cocoa Bindings

If you are using conventional data sources for content you must implement the basic methods that provide the outline view with data: outlineView:child:ofItem:, outlineView:isItemExpandable:, outlineView:numberOfChildrenOfItem:, and outlineView:objectValueForTableColumn:byItem:. Applications that acquire their data using Cocoa bindings do not need to implement these methods.

Similarly, when using conventional data sources , if you want to allow the user to edit values, you must implement outlineView:setObjectValue:forTableColumn:byItem:. When these methods are invoked by the outline view, nil as the item refers to the “root” item. NSOutlineView requires that each item in the outline view be unique. In order for the collapsed state of an outline view to remain consistent between reloads you must always return the same object for an item. When using Cocoa bindings to provide outline view content, there is no requirement to implement this method.

Topics

Instance Methods

outlineView:acceptDrop:item:childIndex:

Returns a Boolean value that indicates whether a drop operation was successful.

outlineView:child:ofItem:

Returns the child item at the specified index of a given item.

outlineView:draggingSession:endedAtPoint:operation:

Implement this method to know when the given dragging session has ended.

outlineView:draggingSession:willBeginAtPoint:forItems:

Implement this method know when the given dragging session is about to begin and potentially modify the dragging session.

outlineView:isItemExpandable:

Returns a Boolean value that indicates whether the a given item is expandable.

outlineView:itemForPersistentObject:

Invoked by outlineView to return the item for the archived object.

outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:

Returns an array of filenames for the created files that the receiver promises to create.

Deprecated
outlineView:numberOfChildrenOfItem:

Returns the number of child items encompassed by a given item.

outlineView:objectValueForTableColumn:byItem:

Invoked by outlineView to return the data object associated with the specified item.

outlineView:pasteboardWriterForItem:

Implement this method to enable the table to be an NSDraggingSource that supports dragging multiple items.

outlineView:persistentObjectForItem:

Invoked by outlineView to return an archived object for item.

outlineView:setObjectValue:forTableColumn:byItem:

Set the data object for a given item in a given column.

outlineView:sortDescriptorsDidChange:

Invoked by an outline view to notify the data source that the descriptors changed and the data may need to be resorted.

outlineView:updateDraggingItemsForDrag:

Implement this method to enable the table to update dragging items as they are dragged over the view.

outlineView:validateDrop:proposedItem:proposedChildIndex:

Used by an outline view to determine a valid drop target.

outlineView:writeItems:toPasteboard:

Returns a Boolean value that indicates whether a drag operation is allowed.

Relationships

Inherits From

See Also

Management

NSOutlineViewDelegate

A set of optional methods implemented by delegates of NSOutlineView objects.