lukasbach / react-complex-tree

Unopinionated Accessible Tree Component with Multi-Select and Drag-And-Drop
https://rct.lukasbach.com
MIT License
893 stars 69 forks source link

Context Menu For Each Folder And Item #349

Open hussain7006 opened 3 months ago

hussain7006 commented 3 months ago

Can you please add the OnContextMenu feature in the tree for each folder and item

lukasbach commented 3 months ago

Can you elaborate on what you suggest as a feature? react-complex-tree already allows customizing the render logic of tree items, you can just register your own context menu handlers there.

https://rct.lukasbach.com/docs/guides/rendering

hussain7006 commented 3 months ago

Yes, I created the context menu but not able to add the folder or items in a tree using context menu. Means context menu having the option create folder and delete folder etc. Thanks

On Fri, 15 Mar 2024, 3:58 AM Lukas Bach, @.***> wrote:

Can you elaborate on what you suggest as a feature? react-complex-tree already allows customizing the render logic of tree items, you can just register your own context menu handlers there.

https://rct.lukasbach.com/docs/guides/rendering

— Reply to this email directly, view it on GitHub https://github.com/lukasbach/react-complex-tree/issues/349#issuecomment-1998614522, or unsubscribe https://github.com/notifications/unsubscribe-auth/APDG6XL5Y2GJ7C6HKPXCQ43YYITQFAVCNFSM6AAAAABEVSFKUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJYGYYTINJSGI . You are receiving this because you authored the thread.Message ID: @.***>

lukasbach commented 3 months ago

As mentioned, you can customize the render logic and add custom logic to your rendered elements like context menus from there. If you want changes to the tree structure to be possible, you need to manage the state of the tree externally, and let RCT know of any changes done through change events. There are multiple ways for how to do this, this page documents how to do this for static tree data providers for example: https://rct.lukasbach.com/docs/guides/static-data-provider