Open Diwei-Chen opened 5 years ago
@BukhariMuslim Sorry, can the prop selectedItems
be repopulated?
Can it be changed by state variable after it has been initialised?
Let's say my items list is [A, B, C, D], selectedItems firstly passed in is [A, B] which points to state variable initSelectedList [A, B]. There are two chips rendering on screen.
If I change initSelectedList to [A, B, C] by a button click, it doesn't seem like C is added to the chips.
This feature is currently rollback, regardless to this comment.
Great, thanks @BukhariMuslim , FYI @adamgins
Hi, thanks for this nice component!
I also had the problem mentioned above, my workaround for the moment is the following:
this._child_selectize = null;
to the constructor in the surrounding component.ref={c => this._child_selectize = c}
to the Selectize
componentitems
and selectedItems
be the variables with the new content, then this code updates the Selectize
component:
const selectize = this._child_selectize, itemId = selectize.props.itemId;
items = selectize._getNormalized({itemId}, items);
selectedItems = selectize._getNormalized({itemId}, selectedItems);
selectize.setState({items, selectedItems});
Yes you can, check this #14