如何使 AutocompleteInput 或 SelectArrayInput 可滚动?
How can I make AutocompleteInput or SelectArrayInput scrollable?
我正在使用 AOR
框架中的 AutocompleteInput
和 SelectArrayInput
,并希望从很多项目中 select。不幸的是,菜单在屏幕上不合适。
如何使列表可滚动?
提前致谢。
根据 Material UI 文档,您可以通过选项传递 listStyle
属性:
<ReferenceArrayInput label="Parts" source="partId" reference="parts" allowEmpty>
<AutocompleteInput optionText="name"
options={{ listStyle: { overflow: 'auto', maxHeight: 200}}} />
</ReferenceArrayInput>
根据您的实施,您也可以使用 SelectManyInput
:
具有相同的行为
<ReferenceArrayInput label="Parts" source="partId" reference="parts" allowEmpty>
<SelectManyInput optionText="name"
options={{ listStyle: { overflow: 'auto', maxHeight: 200}}} />
</ReferenceArrayInput>
Material UI 文档:http://www.material-ui.com/#/components/auto-complete
其余管理员文档:https://marmelab.com/admin-on-rest/Inputs.html#autocompleteinput
类似的东西:
我正在使用 AOR
框架中的 AutocompleteInput
和 SelectArrayInput
,并希望从很多项目中 select。不幸的是,菜单在屏幕上不合适。
如何使列表可滚动?
提前致谢。
根据 Material UI 文档,您可以通过选项传递 listStyle
属性:
<ReferenceArrayInput label="Parts" source="partId" reference="parts" allowEmpty>
<AutocompleteInput optionText="name"
options={{ listStyle: { overflow: 'auto', maxHeight: 200}}} />
</ReferenceArrayInput>
根据您的实施,您也可以使用 SelectManyInput
:
<ReferenceArrayInput label="Parts" source="partId" reference="parts" allowEmpty>
<SelectManyInput optionText="name"
options={{ listStyle: { overflow: 'auto', maxHeight: 200}}} />
</ReferenceArrayInput>
Material UI 文档:http://www.material-ui.com/#/components/auto-complete 其余管理员文档:https://marmelab.com/admin-on-rest/Inputs.html#autocompleteinput
类似的东西: