tree select component search for questions.
import React from "react";
import {TreeSelect} from" antd";
const treeData = [{
]label: "Node1",
value: "0-0",
key: "0-0",
children: [{
label: "Child Node1",
value: "0-0-1",
key: "0-0-1",
}, {
label: "Child Node2",
value: "0-0-2",
key: "0-0-2",
}],
}, {
label: "Node2",
value: "0-1",
key: "0-1",
children: [{
label: "",
value: "0-0-1",
key: "0-0-1",
}, {
label: "",
value: "0-0-2",
key: "0-0-2",
}],
}];
class DataSelectTree extends React.Component {
state = {
value: undefined,
}
onChange = (value) => {
console.log(arguments, value);
this.setState({value});
}
render() {
return (
<TreeSelect
showSearch
treeCheckable
style={{width: 300}}
value={this.state.value}
dropdownStyle={{maxHeight: 400, overflow: "auto"}}
treeData={treeData}
placeholder="json"
treeDefaultExpandAll
onChange={this.onChange}
/>
);
}
}
export default DataSelectTree;
the search only works for individual keywords, such as typing 2, but Filter"s results are also wrong. Figure out how to configure tree-select to make it effective,