Limit the number of choices in member input

This commit is contained in:
Pierre HUBERT 2023-08-26 08:00:29 +02:00
parent 21b64d9f43
commit cf7ad598db

View File

@ -65,11 +65,13 @@ export function MemberInput(p: {
}} }}
options={choices} options={choices}
sx={{ width: "100%" }} sx={{ width: "100%" }}
filterOptions={(options, state) => filterOptions={(options, state) => {
options.filter((m) => const res = options.filter((m) =>
m?.fullName.toLowerCase().includes(state.inputValue) m?.fullName.toLowerCase().includes(state.inputValue)
) );
} res.length = Math.min(15, res.length);
return res;
}}
getOptionLabel={(o) => o?.fullName ?? ""} getOptionLabel={(o) => o?.fullName ?? ""}
renderInput={(params) => <TextField {...params} label={p.label} />} renderInput={(params) => <TextField {...params} label={p.label} />}
renderOption={(_props, option, _state) => ( renderOption={(_props, option, _state) => (