-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeView and TreeItem components #498
Comments
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible. |
Hi @estruyf , |
Hi @estruyf Can you please help to define the end user usage for this control? We propose to have usage something like below: where, treeitems will be an array of JSON with hierarchical structure of TreeItems |
Hi @nanddeepn! I think hierarchical JSON is ok. But I would also think more broadly as this kind of control must be pretty flexible.
@estruyf - any additions? |
Hi @AJIXuMuK Unfortunately, my previous comment discarded html format of proposed usage. Just adding it here again for your review. Please share your view. |
Hey @nanddeepn, <TreeView
items={treeItems}
onSelect={(treeItem: ITreeItem, ...) => {...}}
onExpand={(treeItem: ITreeItem, ...) => {...}}
onRenderItem={(treeItem: ITreeItem, ...) => {...}}
selectionMode={SelectionMode.None/Single/Multi} /> And each interface ITreeItem {
iconProps?: IIconProps;
disabled?: boolean;
data?: any;
key: string;
label: string;
subLabel?: string; //maybe
actions?: IContextualMenuItem[]; // or similar interface
} Something like that on top of my head. |
and as a future improvement - lazy loading. Probably something that can be achieve with |
@AJIXuMuK ...thanks for your valuable suggestion...we have started working on this and will share updates soon... meanwhile, can you help with below confirmation. what will be the schema of 'treeItems' array which will be passed by the end developer while using this control? As of now, we have written logic to convert flat structure to hierarchy structure This will be converted to below object and then we are processing this object to create an actual tree view. So do we need to force the user to pass flat structure and we do the processing to create a hierarchy OR We need to ask user to provide a hierarchy? Please advise. hope this question is making sense :P |
Hi @siddharth-vaghasia, [{
"key": "key",
"text": "text",
...
"children": [...]
}[ |
yes, we also thought so..... thanks... |
Hi @AJIXuMuK , |
Hi @nanddeepn, |
Hi @AJIXuMuK We are thinking of implementing indeterminate state for the parent checkbox (as in image here) Indeterminate state property is supported in Office UI Fabric V7.105.3 (latest version) However Office UI Fabric version supported by SPFx v1.10.0 is 6.189.2, which does not support Indeterminate state property. Questions:
Please advise. Also, when you get time, please check the implementation of this control so far here |
Hi @nanddeepn |
Thanks @AJIXuMuK If you are fine with the implementation, we will raise PR. |
@AJIXuMuK Sending link again as it is broken in above message https://github.com/nanddeepn/code-samples/tree/master/SPFx/TreeView |
Hi @siddharth-vaghasia, @nanddeepn! I have few comments though.
Sorry for the large list. Let me know if you have questions or do not agree with any of the comments. |
@AJIXuMuK ...thanks for the review and your valuable comments... we will go through in detail and get back to you if any queries.. |
@AJIXuMuK ...we have started working on these comments and have some queries/thoughts. Can you please check below and provide your comments.
When user chooses to keep visibility to false, dp we allow them to select tree items? if we allow selecting tree node, we might have to change the background of a label to feel that item is selected. ?
Do you mean if term item is disabled, display tool tip or something on hover that item can't be selected?
We tried this without passing parameter, bu when we want to show/hide all child controls on click of parent one....state object of all child components has to be changed which can only be changed from treeview component. We would need a separate component that should handle rendering of child component(tree item). This might not be possible from tree item. But still if you can look at code and help us understand what approach might work, that would be helpful. |
Yes. I would expect it to look similar to
No. I mean that there are Term Sets and Terms. Term Sets cannot be selected. Terms can be selected. It means that we need an option to specify if this specific Tree Item is selectable. Disabled in a separate setting :)
I don't quite get why this method can't be move to the |
@AJIXuMuK ....thanks...we have incorporated all the changes as request in the comment here
Also on the above - True what you said, it is possible....I was stuck in one place, and being lazy came to an early conclusion that it might not be possible due to the nature of loop we need... but my dear @nanddeepn came to rescue with an idea....we worked it out together :) Can you please check again and let us know if anything. |
Hi @siddharth-vaghasia, @nanddeepn! Sorry for the delay. |
Hey @siddharth-vaghasia, @nanddeepn! I've submitted a small PR with some updates to the component PR-14. Please, align the documentation with the changes and I think we'll be good to go! Thank you again for the great contribution and effort and time you put into it! |
Hi @nanddeepn, @siddharth-vaghasia! For the documentation - please, move all interfaces in Implementation section. Now you describe all additional interfaces in How to use, and the main props in Implementation. Looking forward to seeing the PR! :) |
The PR has been merged to |
Hi everyone, I'm trying to implement the TreeView control, but I find that when the TreeView is rendered, the property "defaultExpanded" of the tree item is hardcoded to "true". I'd like to be able to control the expanded property through the ITreeItem props. There is this property in the state of the TreeItem (ITreeItemState)
How can I control the expanded property programatically? Thanks |
Hi @djmrky |
Hi, yes, I was able to solve the issue of first level nodes (I just added a "dummy" top/root element) and I'm using the defaultSelectedKeys to preselect some node. But what I would like to do is when I set the defaultSelectedKeys (let's say I have single key and the node is on the 4th level) and the tree is rendered, I'd like this node to show as expanded, so it's immediately visible what node is selected. Is this supported right now? |
Hi @djmrky, |
Great discussion @djmrky and @nanddeepn. |
@AJIXuMuK That would be a great enhancement ... I was actually able to change some parts of the code to make this work somewhat, just as a proof of concept. I just added a boolean prop in It would be much better to get this functionality in the package :-) |
Hi @djmrky , Thanks for reporting. |
Category
[x] Enhancement
[ ] Bug
[ ] Question
New component(s)
TreeView
andTreeItem
, should be used as follows:The text was updated successfully, but these errors were encountered: