Skip to content
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

Changes in TreeView #1062

Closed
amirmsai opened this issue Nov 12, 2021 · 7 comments · Fixed by #1205
Closed

Changes in TreeView #1062

amirmsai opened this issue Nov 12, 2021 · 7 comments · Fixed by #1205
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Milestone

Comments

@amirmsai
Copy link
Contributor

amirmsai commented Nov 12, 2021

To define the expanded nodes and dont lose it after a refresh: only to add a block of code in TreeviewItem in componentWillReceiveProps,
It will be like this:
public componentWillReceiveProps(nextProps: IMyTreeItemProps): void {
// If selection is turned on, set the item as selected
if (this.props.selectionMode != MyTreeViewSelectionMode.None) {
let active = nextProps.activeItems.filter(item => item.key === this.props.treeItem.key);

  let _isExpanded:boolean=this.state.expanded;
  if(!_isExpanded &&  this.props.nodesToExpand.indexOf(this.props.treeItem.key) != -1) {
    _isExpanded = true;
  }
  if(_isExpanded && this.props.nodesToExpand.indexOf(this.props.treeItem.key) == -1){
    _isExpanded=false;
  }

  this.setState({
    selected: active.length > 0,
    expanded: _isExpanded
  });
}

}

And add the property defaultExpandedKeys?: string[]; in TreeViewProps

@ghost
Copy link

ghost commented Nov 12, 2021

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Nov 12, 2021
@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Dec 4, 2021

Hi @tounsiAli,

Thank you for the suggestion.
As you've already dig into it - would you be interested in submitting the PR?

Thanks!

@AJIXuMuK AJIXuMuK added type:enhancement New feature or enhancement of existing capability and removed Needs: Triage 🔍 labels Dec 4, 2021
@amirmsai
Copy link
Contributor Author

amirmsai commented Dec 7, 2021 via email

@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Dec 7, 2021

Hi @tounsiAli - here is the documentation on how to contribute: https://pnp.github.io/sp-dev-fx-controls-react/guides/contributing/#tips

In few words - you need to "fork" the repo, create a branch based on dev, do the changes, push the branch and then create a PR in our repo from your branch to dev.

@amirmsai
Copy link
Contributor Author

amirmsai commented Dec 28, 2021 via email

@amirmsai
Copy link
Contributor Author

amirmsai commented Dec 28, 2021 via email

@AJIXuMuK AJIXuMuK added this to the 3.8.0 milestone Apr 19, 2022
@AJIXuMuK AJIXuMuK added the status:fixed-next-drop Issue will be fixed in upcoming release. label Apr 19, 2022
@AJIXuMuK
Copy link
Collaborator

The changes have been merged and will be available in the next release.

@AJIXuMuK AJIXuMuK mentioned this issue May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:enhancement New feature or enhancement of existing capability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants