TreeDataObject Class
A data object backed by a ITree.
To use, import via @fluidframework/aqueduct/legacy
.
For more information about our API support guarantees, see here.
Signature
export declare abstract class TreeDataObject<TDataObjectTypes extends DataObjectTypes = DataObjectTypes> extends PureDataObject<TDataObjectTypes>
Extends: PureDataObject<TDataObjectTypes>
Type Parameters
Parameter | Constraint | Default | Description |
---|---|---|---|
TDataObjectTypes | DataObjectTypes | DataObjectTypes | The optional input types used to strongly type the data object. |
Remarks
In order to view the tree's data, consumers of this type will need to apply the appropriate view schema to the tree. This will generally be done via PureDataObject.initializingFromExisting and PureDataObject.initializingFirstTime methods.
To initialize the tree's data for initial creation, implementers of this class will need to override PureDataObject.initializingFirstTime and set the data in the schema-aware view.
Usage
Example 1
Implementing initializingFirstTime
protected override async initializingFirstTime(): Promise<void> {
// Generate the schema-aware view of the tree.
this.treeView = this.tree.viewWith(treeViewConfiguration);
// Initialize the tree with initial data.
this.treeView.initialize(initialTree);
}
Example 2
Implementing initializingFromExisting
protected override async initializingFromExisting(): Promise<void> {
// Generate the schema-aware view of the tree.
this.treeView = this.tree.viewWith(treeViewConfiguration);
// Ensure the loaded tree is compatible with the view schema.
if (!this.treeView.compatibility.canView) {
// Handle out-of-schema data as appropriate.
}
}
Properties
Property | Alerts | Modifiers | Type | Description |
---|---|---|---|---|
tree | Alpha |
readonly |
ITree | The underlying tree. |
Property Details
tree
The underlying tree.
For more information about our API support guarantees, see here.
Signature
protected get tree(): ITree;
Type: ITree
Remarks
Created once during initialization.