const ItemOptions: SelectValueInterface[] = Item.map((e) => ({
value: e.ItemId,
label: `${e.ItemName} (Item ID : ${e.ItemId})`,
}));
const options = [
{
label: 'ITEM NAME (Item ID)',
options: ItemOptions,
},
];
const formatGroupLabel = (data: any) => (
<div className={styles.formatGroupLabel}>
<span>{data.label}</span>
</div>
);
<Select
placeholder="Select Name"
options={options}
formatGroupLabel={formatGroupLabel}
classNamePrefix="select-list"
value={ItemOptions.filter((option) => option.value === selectedItemId)}
onChange={filterByItemID}
/>;
Run Code Online (Sandbox Code Playgroud)
当我输入搜索/排序时,Item ID它会显示所有选项。我想不检测(Item ID: number)。
react-select ×1