JairajJangle / react-native-tree-multi-select

Super-fast tree view with multi-selection capabilities, using checkboxes and search filtering.
MIT License
35 stars 4 forks source link

[FEAT-REQ]: count of checked items in a parent node #34

Closed OmkarK45 closed 2 months ago

OmkarK45 commented 2 months ago

Hey! Thanks for this incredible library!

Is there an approach for getting the count of checked subNodes under a node?

For example

└── Cars (2 out of 3)/
    ├── [x] Hyundai
    ├── [x] Benz
    └── [ ] Tesla
JairajJangle commented 2 months ago

Hi @OmkarK45 👋! Thank you so much for your kind words! 😊 It’s great to hear that you find the module to be flexible and useful.

To help demonstrate how you can display the ratio of checked children to total children next to the node's name, I've prepared a small example for you: https://snack.expo.dev/@futurejj/ludicrous-red-popcorn. This example incorporates the extraData parameter in treeFlashListProps to ensure that all items in the FlashList are updated with the latest checkedIds. Please note, there might be more optimized ways to handle this.

For more details, take a look at the getSuffix function in CustomNodeRowView.tsx. Feel free to experiment with the customizations and see what works best for your project. Also, be sure to check out our example app for additional guidance and ideas.

I hope you find this helpful! Let me know how it works out for you, or if there’s anything else you’d like to discuss. Cheers! 🚀

OmkarK45 commented 2 months ago

This is helpful, thanks a lot! Appreciate taking the time to create the expo snack too