我正在 react-admin 中处理一个项目,并尝试在 ReferenceInputs 中使用 AutocompleteInputs 来过滤列表中的内容。该列表是与两个不同用户(消费者和提供者)有关系的产品。我目前能够获得消费者和提供者的选择,并通过其中之一过滤我的产品列表。
但是,我的问题出现在自动建议中。这根本行不通。输入 AutocompleteInput 不会过滤消费者或提供者的选择。我在 ArrayReferenceInput 中有另一个 AutocompleteArrayInput 用于类似设置的提供程序,并且自动建议工作得非常好。
有什么想法吗?
这是损坏的 AutocompleteInput:
export const ProductFilter = props => (
<Filter {...props}>
<ReferenceInput label="Consumer" reference="consumers"
source="consumer_user_id" allowEmpty>
<AutocompleteInput source="id" optionText={FullNameRenderer} />
</ReferenceInput>
<ReferenceInput label="Provider" reference="providers"
source="provider_user_id" alwaysOn allowEmpty>
<AutocompleteInput optionText={FullNameRenderer} />
</ReferenceInput>
<DateRangeInput alwaysOn />
</Filter>
)
这是工作的 AutocompleteArrayInput:
export const ConsumerEdit = props => (
<Edit {...props}>
<TabbedForm redirect="show">
<FormTab label="Providers" path="provider_assignmenmts">
<ReferenceArrayInput label='Assigned Providers'
reference='providers' defaultValue={[]}
source="provider_ids" allowEmpty>
<AutocompleteArrayInput optionText={FullNameRenderer}/>
</ReferenceArrayInput>
</FormTab>
</TabbedForm>
</Edit>
)
好吧,看起来这是 react-admin 中的一个更大的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句