-
Notifications
You must be signed in to change notification settings - Fork 295
Removal Of 'terminal' attribute in children #11
Comments
It makes sense for your core module. But you should really consider to outsource the toggle functionality to your decorator and join together header/toggle, as this would easily allow us to customize the behavior. |
Maybe a good step in the right direction is for treebeard to determine this and pass it as a |
Separate those properties, that you need for core functionality (children, toggled) and those additional for default out-of-the-box behavior (name, active, ...). Allow for a custom .id property used as a key instead of 'index' for building the tree. Allow for renaming core properties by this occasion, like items instead of children. Don't forget that there will always be the users who want their tree state managed by treebeard and those who want to manage it themselves, which currently works okay if you suppress the default onToggle with e.preventDefault(), so there is no setState({toggled: true}). |
Also it would be great to use something like http://jnuno.com/tree-model-js/ to store the tree data, but a node will have its function isToggled(node){
return node.model.toggled;
}
<TreeBeard isToggled={isToggled}/> |
I'll add in the id -> key option as I think that is definitely a good idea. We have to make sure we aren't making it over complicated with some of these things. |
This could be derived from the
children
attribute. If children is undefined, then it is a terminal node. If children is[empty]
array then it is a potential parent, that needs to load in its children. If children has elements, then it is definitely a parent node. Can anyone see any issues with this?The text was updated successfully, but these errors were encountered: