frontend-collective / frontend-collective/react-sortable-tree

Child Nodes should get updated separately

Open
#381 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

I have a scenario:
1. OnClick of parent1 the child should get added, which i have implemented.
2. Then Onclick of child1, I need to open a form which will have input fields and on update/modifying input fields node should get updated accordingly.
3. Now, if I'm trying to create an another child2 under same parent1, the updated or modified input fields of child1 appears as it is on child2 node.
Expected behavior:
Child2 should open with the fresh form parameters, it should not take the values from child1 form.

generateNodeProps={rowInfo => ({
onClick: (e) => {
const clickedItemClassName = e.target.className;
if (
clickedItemClassName === 'rstcustom__rowTitle'
) {
this.nodeLableSelected(rowInfo);
}
}});

nodeLableSelected(rowInfo) {
let self = this;
let newObject = {...self.props};

newObject.history.push({
pathname: '/'+rowInfo.treeIndex,
rowInfo: rowInfo,
// postThingJson: postThingJson,
treeData: this.state.treeData,
patentName: rowInfo.parentNode == null ? this.state.treeData[0].title :
rowInfo.parentNode.title
== null ? this.state.treeData[0].title : rowInfo.parentNode.title)
});
}



self.onChangeValue( e)} />

onChangeValue = ( event) => {
const target = event.target;
const name = target.name;
const value = target.value;

let newObject = [...this.state.thing.properties];
newObject.forEach(function (property) {
// property.defaultValue = "";
if (property.name == name) {
property.defaultValue = value;
return false;
}
else {
return true
}
})
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.