Skip to content

Commit 83a1834

Browse files
Bug/804 (#850)
* Fix 804 - Expand Nodes to selected node * TreeView - don't add target node to expand array
1 parent 3d1cb39 commit 83a1834

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/controls/treeView/TreeItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export default class TreeItem extends React.Component<ITreeItemProps, ITreeItemS
211211
/**
212212
* Process the child nodes
213213
*/
214-
public createChildNodes = (list, paddingLeft) => {
214+
public createChildNodes = (list: ITreeItem[], paddingLeft: number) => {
215215
if (list.length) {
216216
const {
217217
treeItem,

src/controls/treeView/TreeView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class TreeView extends React.Component<ITreeViewProps, ITreeViewState> {
4444
if (array) {
4545
array.some(({ key, children = [] }) => {
4646
if (key === target) {
47-
this.nodesToExpand.push(key);
47+
// this.nodesToExpand.push(key);
4848
result = key;
4949
return true;
5050
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
412412
canMoveNext: true,
413413
currentCarouselElement: this.carouselElements[0],
414414
comboBoxListItemPickerListId: '0ffa51d7-4ad1-4f04-8cfe-98209905d6da',
415-
treeViewSelectedKeys: ['gc1', 'gc3'],
415+
treeViewSelectedKeys: ['3', 'gc3'],
416416
showAnimatedDialog: false,
417417
showCustomisedAnimatedDialog: false,
418418
showSuccessDialog: false,
@@ -1579,8 +1579,8 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
15791579
defaultSelectedKeys={this.state.treeViewSelectedKeys}
15801580
onExpandCollapse={this.onExpandCollapseTree}
15811581
onSelect={this.onItemSelected}
1582-
defaultExpandedChildren={true}
1583-
//expandToSelected={true}
1582+
defaultExpandedChildren={false}
1583+
expandToSelected={true}
15841584
// onRenderItem={this.renderCustomTreeItem}
15851585
/>
15861586
<PrimaryButton onClick={() => { this.setState({ treeViewSelectedKeys: [] }); }}>Clear selection</PrimaryButton>

0 commit comments

Comments
 (0)