You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI: It seems there aren't any official APIs to do that (as far as I see), but if you may use unofficial APIs, this worked for me:
classFooextendsReact.Component{constructor(){super();this.selectableGroup=React.createRef();}/** like SelectableGroup.selectAll(), but select only elements with `defaultSelected` prop */selectDefaults(){constselectableGroup=this.selectableGroup.current;selectableGroup.removeIgnoredItemsFromRegistry();for(constitemofselectableGroup.registry.values()){if(item.props.defaultSelected){item.setState({isSelected: true});selectableGroup.selectedItems.add(item);}}selectableGroup.setState({selectionMode: true});}componentDidMount(){this.selectDefaults();}render(){return(<SelectableGroupref={this.selectableGroup}...>{list.map((item,ix)=><SelectableItemdefaultSelected={ ... }key={ ix })}
</SelectableGroup>
);
}}
I want to set some items default selected how can I achive that.
Thanks!
The text was updated successfully, but these errors were encountered: