How to use the react-sortable-tree.changeNodeAtPath function in react-sortable-tree

To help you get started, we’ve selected a few react-sortable-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openworm / org.geppetto.frontend / src / main / webapp / js / components / interface / tree / Tree.js View on Github external
callback: (rowInfoIter) => {
						var isActive = (rowInfoIter.treeIndex == rowInfo.treeIndex);
						// If toggleMode just toggle to activate/inactivate selected node
						// If non toggle mode inactive all nodes but selected
						if (isActive && toggleMode) {
							rowInfoIter.node.active = !rowInfoIter.node.active;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}
						else if (isActive != rowInfoIter.node.active  && !toggleMode) {
							rowInfoIter.node.active = isActive;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}

					}
				});
github openworm / org.geppetto.frontend / src / main / webapp / js / components / interface / tree / Tree.js View on Github external
handleClick(event, rowInfo) {
			var toggleMode = this.props.toggleMode;
			var currentTreeData = this.state.treeData;
			// If node has children, we expand/collapse the node
			if (rowInfo.node.children != undefined && rowInfo.node.children.length > 0) {
				rowInfo.node.expanded = !rowInfo.node.expanded;
				currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfo.path, newNode: rowInfo.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
			}
			// If node has no children, we select the node
			else if (rowInfo.node.children == undefined) {
				walk({
					treeData: currentTreeData,
					getNodeKey: ({ treeIndex }) => treeIndex,
					ignoreCollapsed: false,
					callback: (rowInfoIter) => {
						var isActive = (rowInfoIter.treeIndex == rowInfo.treeIndex);
						// If toggleMode just toggle to activate/inactivate selected node
						// If non toggle mode inactive all nodes but selected
						if (isActive && toggleMode) {
							rowInfoIter.node.active = !rowInfoIter.node.active;
							currentTreeData = changeNodeAtPath({ treeData: currentTreeData, path: rowInfoIter.path, newNode: rowInfoIter.node, getNodeKey: ({ treeIndex }) => treeIndex, ignoreCollapsed: false });
						}
						else if (isActive != rowInfoIter.node.active  && !toggleMode) {
github ReactPrimer / ReactPrimer / src / App.js View on Github external
this.setState(state => ({
       treeData: changeNodeAtPath({
         treeData: state.treeData,
         path,
         getNodeKey,
         newNode: { ...node, isStateful:true }
       })
     }))
   }
github Nubuck / z1-app-starter / web / src / features / screen-cmd / views / view-editor / main.js View on Github external
onChange={event => {
                            mutations.dataChange({
                              data: changeNodeAtPath({
                                treeData: state.data,
                                path,
                                getNodeKey,
                                newNode: {
                                  ...node,
                                  element: event.target.value,
                                },
                              }),
                            })
                          }}
                        >
github CLOSER-Cohorts / archivist / react / src / pages / InstrumentConstructBuild.js View on Github external
const updateNode = ({ node, path }) => {
    var data = changeNodeAtPath({
        treeData: treeData,
        path,
        getNodeKey,
        newNode: TreeNodeFormatter(instrumentId, node)
      })
      setTreeData(data)
      reorderConstructs(data)
  }
github apjs / ReactVelocity / src / components / react-tree.js View on Github external
this.setState(state => ({
                      treeData: changeNodeAtPath({
                        treeData: state.treeData,
                        path,
                        getNodeKey,
                        newNode: { ...node, name },
                      }),
                    }));
                  }}
github Graylog2 / graylog2-server / graylog2-web-interface / src / components / search / QuerySidebar.jsx View on Github external
const disableNode = ({ node, path, treeIndex }) => {
      const newTree = changeNodeAtPath({ treeData: this.state.tree, path, getNodeKey, newNode: { ...node, disabled: !node.disabled }});
      QueryTreeActions.update(newTree);
    };
    return (
github apjs / ReactVelocity / src / components / redux-tree.js View on Github external
this.setState(state => ({
                      treeData: changeNodeAtPath({
                        treeData: state.treeData,
                        path,
                        getNodeKey,
                        newNode: { ...node, name},
                      }),
                    }));
                  }}
github MetaCell / NetPyNE-UI / webapp / components / general / FileBrowser.js View on Github external
.then(dirList => {
        if (treeData != [] && treeData.length > 0) {
          rowInfo.node.children = dirList;
          rowInfo.node.expanded = true;
          rowInfo.node.load = true;
          var newTreeData = changeNodeAtPath({ 
            treeData: treeData, 
            path: rowInfo.path, 
            newNode: rowInfo.node, 
            getNodeKey: ({ treeIndex }) => treeIndex 
          });
        } else {
          var newTreeData = dirList;
        }
        if (!this.props.exploreOnlyDirs || rowInfo == undefined){
          this.setState({ selection: undefined })
        } else {
          this.setState({ selection: rowInfo.node })
        }
        this.refs.tree.updateTreeData(newTreeData);
      });
  }