Comments (7)
You can already do this by setting a keyProp, as described in the docs.
Property | Type | Mandatory | Default | Description |
---|---|---|---|---|
keyProp |
string | "name" | The property on each node to use as a key. |
from react-tree-graph.
I saw that, but it does not work with the tree view example.
Setting the property causes error on (only) duplicate nodes
TypeError: node.children is undefined
from react-tree-graph.
Can you add your code that's reproducing the issue? The JSON date you're using and the props you're passing into the Tree component should be enough.
from react-tree-graph.
Without changing any code, this is the json
`export default {
timestamp: '14/12/2016 22:00',
name: 'Colour',
sortvalue: 'Colour',
children: [{
name: 'Cyan',
sortvalue: "Cyan_1",
children: []
}, {
name: 'Blue',
sortvalue: 'Blue',
children: [{
name: 'Aquamarine',
sortvalue: 'Aquamarine',
children: []
}, {
name: 'Cyan',
sortvalue: "Cyan_2",
children: []
}, {
name: 'Navy',
sortvalue: 'Navy',
children: []
}, {
name: 'Turquoise',
sortvalue: 'Turquoise',
children: []
}]
}, {
name: 'Green',
sortvalue: 'Green',
children: []
}, {
name: 'Purple',
sortvalue: 'Purple',
children: [{
name: 'Indigo',
sortvalue: 'Indigo',
children: []
}, {
name: 'Violet',
sortvalue: 'Violet',
children: []
}]
}]
};`
and this is the tree construct:
<Tree animated data={root} height={this.props.height} width={this.props.width} keyProp={'sortvalue'} gProps={{ className: 'node', onClick: setActiveNode }} steps={30}/>
With only addition of the
keyProp={'sortvalue'}
from react-tree-graph.
I've created an issue-10 branch with those changes and it works for me. Are you sure your code has been rebuilt with your changes? Can you try running npm run build-dev -- --watch
or committing your changes to a fork somewhere?
from react-tree-graph.
hum, here is the form and included output when it crashes
https://github.com/Northshoot/tree-viewer/commits/master
from react-tree-graph.
Those changes still work for me. I suspect it's an issue with building the code.
from react-tree-graph.
Related Issues (20)
- Changing data value of Tree causes the new tree to be overlaid on the old one HOT 1
- Node keys not appearing in onClick events
- Add zoom functionality HOT 8
- Increasing width of text HOT 2
- Translate values dont have units. HOT 1
- Options to change display per node HOT 2
- Options to change different icon per node. HOT 1
- Change stack order of an element ("z-index") HOT 1
- html example? HOT 1
- can add drag and drop the nodes? HOT 2
- Supported typescript ? HOT 1
- Is there a way for 2+ nodes to point to same child? HOT 1
- Possibility to display more data other than "name" HOT 4
- Right to left tree graph HOT 2
- Demo not working properly HOT 1
- How can i have tooltip when over on nodes ? HOT 1
- Straight line path function for links HOT 1
- Color leaf in diffrent color HOT 6
- Set hardcoded position (x, y) of the Node HOT 1
- Add TypeScript definitions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-tree-graph.