ReferenceArrayInput和SelectArrayInput无法按预期工作

问题描述 投票:1回答:1

希望有人可以帮助我。我想创建一个包含标题,消息和用户ID数组的通知(用于特定通知)。我使用ReferenceArrayInputSelectArrayInput来实现此功能,但它不能按预期工作。

App.jsx

<Admin authClient={authClient(feathersClient, authClientOptions)}
       restClient={restClient(feathersClient, options)}>
        <Resource name="users" list={UserList} options={{label: 'Usuarios'}} icon={UsersIcon}/>
        <Resource name="notifications" list={NotificationsList} create={NotificationsCreate} options={{label: 'Notificaciones'}} icon={NotificationIcon}/>
</Admin>

Notifications/create.jsx

<Create title="Crear notificación" {...this.props}>
     <SimpleForm>
         <TextInput source="title" label="Título"/>
         <TextInput source="message" label="Mensaje" />
         <ReferenceArrayInput source="recipients" reference="users" label="Usuarios">
             <SelectArrayInput optionText='firstName'/>
         </ReferenceArrayInput>
      </SimpleForm>
</Create>

单击呈现的输入时,它会正确地提取用户,但是当单击用户时,它不会将芯片推送到输入。我不知道为什么,如果来自服务器的用户数组是正确的,当我选择一个用户时,不会将它添加到收件人数组中。

这是我的package.json有关该项目的其他知识

{
  "name": "gmx-web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "admin-on-rest": "^1.3.2",
    "aor-feathers-client": "^0.7.1",
    "feathers-client": "^2.4.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.0.17"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
reactjs admin-on-rest
1个回答
0
投票

当你在Create组件中时,你尝试将allowEmpty道具添加到ReferenceArrayInput吗?

© www.soinside.com 2019 - 2024. All rights reserved.