Проблема пользовательских кнопок при использовании aor-embedded-array

Я пытаюсь добавить пользовательские кнопки для элемента в EmbeddedArrayField но не вижу пользовательскую кнопку. Я сослался на документацию - https://github.com/MhdSyrwan/aor-embedded-array. Вот мой код -

index.js

export const CategoryShow = (props) => (
    <Show {...props}>
        <SimpleShowLayout>
            <TextField source="name" />
            <TextField source="code" />
            <EmbeddedArrayField source="subcategories"  
            actionsContainerStyle={style.actionsContainerStyle}  
             customButtons={[<CustomDeleteButton key={0}/>]} >
                <TextField source="name" />
                <TextField source="code" />
            </EmbeddedArrayField>
        </SimpleShowLayout>
    </Show>
);

CustomDeleteButton.js

const CustomDeleteButton = ({items, index}) => (
    <FlatButton
        key={index}
        secondary
        label="Delete"
        icon={<ActionDeleteIcon />}
        onClick={() => {
            // Take custom action
            console.log(items, index);
            items.remove(index);
        }}
    />
)
export default CustomDeleteButton;

Любая помощь будет высоко оценена.

0 ответов

Другие вопросы по тегам