Limit the number of choices in member input
This commit is contained in:
parent
21b64d9f43
commit
cf7ad598db
@ -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) => (
|
||||||
|
Loading…
Reference in New Issue
Block a user