Skip to content

Help creating a custom tree data provider #252

Answered by lukasbach
PetervdHemel asked this question in Q&A
Discussion options

You must be logged in to vote

Edit: I expanded the docs on static data providers and on custom data providers, which right now is the best entry point with details on how to approach this.

A simple example is actually the implementation of the StaticTreeDataProvider itself, it implements all methods of a tree data provider, and with 50 LOC it's pretty manageable to understand: https://github.com/lukasbach/react-complex-tree/blob/main/packages/core/src/uncontrolledEnvironment/StaticTreeDataProvider.ts

The gist is to implement a getTreeItem(itemId: string | number): Promise<Item> method that allows RCT to retrieve item data for item IDs. All other methods are pretty much additional features. If you expect your items to …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by PetervdHemel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants