rx-datatable API
    Preparing search index...

    Type Alias TreeListMainProps<T>

    TreeListMainProps:
        | {
            getChildren?: undefined;
            getParents?: undefined;
            isParent?: undefined;
            list?: undefined;
            tree: TreeItemM<T>[];
        }
        | {
            getParents?: undefined;
            isParent?: undefined;
            list: T[];
            tree?: undefined;
            getChildren(item: T): T[] | undefined;
        }
        | {
            getChildren?: undefined;
            list: T[];
            tree?: undefined;
            getParents?(item: T): T[] | undefined;
            isParent?(item: T): boolean;
        }

    Describes the items to display including parent-child relationships. You can either provide a tree directly, or a list with getChildren / getParents functions to describe these relationships.

    Type Parameters

    • T

    Type Declaration

    • {
          getChildren?: undefined;
          getParents?: undefined;
          isParent?: undefined;
          list?: undefined;
          tree: TreeItemM<T>[];
      }
      • OptionalgetChildren?: undefined
      • OptionalgetParents?: undefined
      • OptionalisParent?: undefined
      • Optionallist?: undefined
      • tree: TreeItemM<T>[]

        Provides a tree in the "native" format of TreeListCore/TreeList/DataTable.

        Note: TreeListCore assumes that all parent and children props are consistent with each other, e.g. that tree[i].children[j].parent === tree[i]. It will malfunction otherwise.

        Note: This is TreeItemM rather than TreeItem because TreeListCore (via flattenToList) will sort sublists mutably when there is no filter applied.

    • {
          getParents?: undefined;
          isParent?: undefined;
          list: T[];
          tree?: undefined;
          getChildren(item: T): T[] | undefined;
      }
      • OptionalgetParents?: undefined
      • OptionalisParent?: undefined
      • list: T[]
      • Optionaltree?: undefined
      • getChildren: function
        • Gets the children of an item. It is useless to provide both a getParents and getChildren prop, as only one will be called.

          Parameters

          • item: T

          Returns T[] | undefined

    • {
          getChildren?: undefined;
          list: T[];
          tree?: undefined;
          getParents?(item: T): T[] | undefined;
          isParent?(item: T): boolean;
      }
      • OptionalgetChildren?: undefined
      • list: T[]

        List of items to display. If getParents is provided, then items with parents are not displayed at the root level (they are nested inside their parents); otherwise, all items in this list are displayed at the root level and there may be additional items (not in this list) nested inside them if getChildren returns items.

      • Optionaltree?: undefined
      • getParents?: function
        • Gets the parents of an item (that is, the path to reach the item). The parents must be listed in order from root to child. This function is only called for items in the list, not for items returned by getParents itself.

          Example: getParents={filename => getParentPathsOf(filename, '/', false)}

          Parameters

          • item: T

          Returns T[] | undefined

      • isParent?: function
        • getParents by itself gives you no way to indicate that an item is a parent without children (e.g. an empty folder). If this function returns true, an item's expansion icon is displayed even when it has no children. This property is unused if you don't provide getParents. TODO: if isParent and getChildren are both provided, we shouldn't call getChildren() for unexpanded nodes. In fact, right now all unexpanded nodes are retrieved recursively which is wasteful.

          Parameters

          • item: T

          Returns boolean