Skip to content

Commit a7b3bea

Browse files
author
Kyle Crawford
committed
provide approach for unserialized array inputs
1 parent d9fd772 commit a7b3bea

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

admin/getting-started.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ in the `admin/src/Component/User` directory:
321321
// admin/src/Component/User/Create.js
322322

323323
import React from 'react';
324-
import { Create, SimpleForm, TextInput, email, required } from 'react-admin';
324+
import { Create, SimpleForm, TextInput, email, required, ArrayInput, SimpleFormIterator } from 'react-admin';
325325

326326
export const UserCreate = (props) => (
327327
<Create { ...props }>
@@ -330,6 +330,11 @@ export const UserCreate = (props) => (
330330
<TextInput source="plainPassword" label="Password" validate={ required() } />
331331
<TextInput source="name" label="Name"/>
332332
<TextInput source="phone" label="Phone"/>
333+
<ArrayInput source="roles" label="Roles">
334+
<SimpleFormIterator>
335+
<TextInput />
336+
</SimpleFormIterator>
337+
</ArrayInput>
333338
</SimpleForm>
334339
</Create>
335340
);
@@ -340,7 +345,7 @@ export const UserCreate = (props) => (
340345
// admin/src/Component/User/Edit.js
341346

342347
import React from 'react';
343-
import { Edit, SimpleForm, DisabledInput, TextInput, DateInput, email } from 'react-admin';
348+
import { Edit, SimpleForm, DisabledInput, TextInput, email, ArrayInput, SimpleFormIterator, DateInput } from 'react-admin';
344349

345350
export const UserEdit = (props) => (
346351
<Edit {...props}>
@@ -349,6 +354,11 @@ export const UserEdit = (props) => (
349354
<TextInput source="email" label="Email" validate={ email() } />
350355
<TextInput source="name" label="Name"/>
351356
<TextInput source="phone" label="Phone"/>
357+
<ArrayInput source="roles" label="Roles">
358+
<SimpleFormIterator>
359+
<TextInput />
360+
</SimpleFormIterator>
361+
</ArrayInput>
352362
<DateInput disabled source="createdAt" label="Date"/>
353363
</SimpleForm>
354364
</Edit>

0 commit comments

Comments
 (0)