Closed shaileshy8787 closed 4 years ago
This error happens because several of the nodes in your example have the same value (there are multiple nodes of value 1
for example). As stated in the README, the value
for each node must be unique relative to all other nodes.
The next release of this component will throw a CheckboxTreeError
when it detects duplicates to provide better troubleshooting.
any comment on my issue? I donot have any duplicates ..
/ eslint-disable no-unused-vars / import "jquery"; import React from "react"; import CheckboxTree from "react-checkbox-tree";
const data = [ { id: 1, name: "Europe", code: "EU", countries: [ { id: 679, name: "France", cities: [ { id: 2347, name: "Paris" }, { id: 2342, name: "Menton" }, ], }, { id: 432, name: "Ukraine", cities: [ { id: 32, name: "Kyiv" }, { id: 5678, name: "Lviv" }, ], }, ], }, { id: 2, name: "North America", code: "US", countries: [ { id: 67, name: "United States", cities: [ { id: 98, name: "Chicago" }, { id: 765, name: "New York" }, { id: 634, name: "Los Angeles" }, ], }, ], }, ];
const accessors = [ { label: "name", value: "id", leaves: "countries", type: "continent", }, { label: "name", value: "id", leaves: "cities", type: "country", }, { label: "name", value: "id", type: "city", }, ];
export default class TestTree extends React.Component { constructor(params) { super(params);
this.action = this.action.bind(this);
}
action(s) { console.log(this.refs.tree.getValues()); }
render() { return ( <div style={{ margin: "150px" }}> <CheckboxTree ref="tree" data={data} accessors={accessors} onChange={this.action} />
@ManjunathBE can you post a live example showcasing this issue?
You can modify this CodeSandbox reference point to create a working example.
Closing due to lack of activity. @ManjunathBE if you still have issues, please feel free to re-open with a live example that I can reference.
Passign below json object in node getting issues.