CCKit2
    Preparing search index...

    Interface CCOutlineViewDataSource<Item>

    An outline view data source provides the content for an outline view.

    interface CCOutlineViewDataSource<Item extends AnyNotNil> {
        childOfItem(
            outlineView: CCOutlineView<Item>,
            index: number,
            parent?: Item,
        ): Item;
        columnIsSortable?(table: CCOutlineView<Item>, column: number): boolean;
        numberOfChildrenOfItem(
            outlineView: CCOutlineView<Item>,
            item?: Item,
        ): number;
        numberOfColumns(outlineView: CCOutlineView<Item>): number;
        titleForColumn?(table: CCOutlineView<Item>, column: number): string;
        viewForItemAtColumn(
            outlineView: CCOutlineView<Item>,
            item: Item,
            column: number,
        ): CCView;
        widthOfColumn?(table: CCOutlineView<Item>, column: number): number;
    }

    Type Parameters

    • Item extends AnyNotNil

      Type of object that the data source provides

    Index

    Methods

    • Returns the child item at the specified index in the parent. If the parent is undefined, returns a root-level item.

      To maintain expanded status across refreshes, this should return an equivalent object (through __eq if necessary) to previous calls with the same parameters. If a new object is returned each time, expanded status will not be preserved across refreshes, so calling update on the view will collapse all items.

      Parameters

      • outlineView: CCOutlineView<Item>

        The view being called on

      • index: number

        The 0-based index of the item

      • Optionalparent: Item

        The parent to query, or undefined for root items

      Returns Item

      An opaque object containing info for the data source to use later

    • Returns whether the specified column is valid for sorting. The application must implement sorting columns on its own, using sortColumn on the table view.

      Parameters

      • table: CCOutlineView<Item>

        The table requesting data

      • column: number

        The 0-based column to query

      Returns boolean

      Whether the column can be used for sort order in the table

    • Returns the number of children for an item. Negative numbers will hide the disclosure indicator, while 0 will keep it but show no children.

      Parameters

      • outlineView: CCOutlineView<Item>

        The view being called on

      • Optionalitem: Item

        The item to query (from childOfItem), or undefined for the number of root items

      Returns number

      The number of items under the parent

    • Returns the title for the specified column. If unimplemented, the table will not have a header row.

      Parameters

      • table: CCOutlineView<Item>

        The table requesting data

      • column: number

        The 0-based column to query

      Returns string

      The text showed in the header for the column

    • Returns the width of a column, overriding the width of the view. If not implemented, the width is determined from the content.

      Parameters

      • table: CCOutlineView<Item>

        The table requesting data

      • column: number

        The 0-based column to query

      Returns number

      The width of the column