Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/dynamic-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Demo = React.createClass({
};
},
onChange(value, selectedOptions) {
console.log(value, selectedOptions);
this.setState({
inputValue: selectedOptions.map(o => o.label).join(', '),
});
Expand Down Expand Up @@ -50,6 +51,7 @@ const Demo = React.createClass({
options={this.state.options}
loadData={this.loadData}
onChange={this.onChange}
changeOnSelect
>
<input value={this.state.inputValue} readOnly />
</Cascader>
Expand Down
3 changes: 3 additions & 0 deletions src/Menus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Menus extends React.Component {
activeValue[menuIndex] = targetOption.value;
const activeOptions = this.getActiveOptions(activeValue);
if (targetOption.isLeaf === false && !targetOption.children && this.props.loadData) {
if (this.props.changeOnSelect) {
this.props.onChange(activeOptions, { visible: true });
}
this.props.onSelect({ activeValue });
this.props.loadData(activeOptions);
return;
Expand Down