Skip to main content

useCATreeView

@spartanfx/react v1.2.2


@spartanfx/react / codeapps / useCATreeView

Function: useCATreeView()

function useCATreeView(config): ICATreeViewReturn;

Shared Power Apps Code Apps hook backing the SharePoint + Dataverse TreeView adapters. Reads rows from a generated tabular service and shapes them for the TreeView (parent/child or path hierarchy).

Configuration

Required

PropertyTypeDescription
fieldMappingICATreeViewFieldMappingColumn mapping.
modeTreeViewHierarchyModeHierarchy model — 'parentId' (self-lookup) or 'path' (library).
serviceICATabularService<CATreeRecord, string>Generated tabular service from pac code add-data-source.

Options

PropertyTypeDescription
autoRefresh?booleanEnable auto-refresh after mutations (default: true).
cacheDuration?numberCache TTL for read results in ms (default: 60_000).
debug?booleanEnable verbose console logging (default: false).
odataFilter?stringOptional OData $filter expression.
orderColumn?stringOptional $orderby column.
retryPolicy?ICARetryPolicyRetry policy for transient failures.
rowLimit?numberMaximum records per fetch (default: 5000).

Events & callbacks

PropertyTypeDescription
onError?(error) => voidError callback. Called for every operational failure.
onNotify?CANotifyFnNotification callback. If omitted, hook errors surface via error state only.

Full type reference: ICATreeViewBaseConfig

Returns

ICATreeViewReturn