react-admin

Injecting List, Show, Edit, Create in any places

无人久伴 提交于 2021-01-28 04:00:41
问题 I would like create a file browser with <List /> component in <Show /> component. Let's say we have a user with home directory and we want to create a file browser to this directory with ability to remove files. The idea of files doesn't match the idea of simple tables, which rows can be edited. So I have created my own component with username and directory as states, useDataprovider() as hook, and <Table/> from MUI, altered data provider a bit. And it works quite nice. The problem comes when

ArrayInput with SimpleFormIterator and conditional inputs

一个人想着一个人 提交于 2021-01-28 00:30:24
问题 Let's say I have the following array in my create form const CreateDefaults = {Inputs: [{id: "ID1", param: "a"},{id: "ID2", param: "b"}]}; and then I want to show extra TextInput only when id==="ID2" export const MyCreate = withStyles(myStyles)(({ classes, ...props }) => ( <Create {...props}> <SimpleForm defaultValue={CreateDefaults}> <ArrayInput source="Inputs" {...props}> <SimpleFormIterator {...props}> <DisabledInput source="id" /> {/*this does not work*/} {this.id === "ID2" ? (<TextInput

Tutorial throws context is undefined error in SaveContext

旧巷老猫 提交于 2021-01-04 09:15:51
问题 This may be a newbie problem, but I'm working though react-admin/Tutorial.html and when it comes to using the EditGuesser the 'Edit' page fails, reporting 'TypeError: context is undefined'. AFAIK, I've followed the instructions. The error is reported after making the adjustment to introduce the 'edit={EditGuesser}' change in the 'Adding Creation and Editing Capabilities' section. I can see that the tutorial code has been edited, as the const definition of the dataProvider has been removed.

Tutorial throws context is undefined error in SaveContext

戏子无情 提交于 2021-01-04 09:15:49
问题 This may be a newbie problem, but I'm working though react-admin/Tutorial.html and when it comes to using the EditGuesser the 'Edit' page fails, reporting 'TypeError: context is undefined'. AFAIK, I've followed the instructions. The error is reported after making the adjustment to introduce the 'edit={EditGuesser}' change in the 'Adding Creation and Editing Capabilities' section. I can see that the tutorial code has been edited, as the const definition of the dataProvider has been removed.

react-admin TypeError: Cannot read property 'save' of undefined

╄→гoц情女王★ 提交于 2021-01-01 07:17:55
问题 I'm trying to show a list of users with react-admin. CustomerList.tsx import React from 'react'; import { TextField, Datagrid, DateInput, DateField, Filter, List, EmailField, SearchInput, SimpleForm, } from 'react-admin'; import { useMediaQuery, Theme } from '@material-ui/core'; import MobileGrid from './MobileGrid'; const CustomerFilter = (props: any) => ( <Filter {...props}> <SearchInput source='q' alwaysOn /> <DateInput source='created_at' /> </Filter> ); const CustomerList = (props: any)

react-admin TypeError: Cannot read property 'save' of undefined

女生的网名这么多〃 提交于 2021-01-01 07:15:11
问题 I'm trying to show a list of users with react-admin. CustomerList.tsx import React from 'react'; import { TextField, Datagrid, DateInput, DateField, Filter, List, EmailField, SearchInput, SimpleForm, } from 'react-admin'; import { useMediaQuery, Theme } from '@material-ui/core'; import MobileGrid from './MobileGrid'; const CustomerFilter = (props: any) => ( <Filter {...props}> <SearchInput source='q' alwaysOn /> <DateInput source='created_at' /> </Filter> ); const CustomerList = (props: any)

react-admin TypeError: Cannot read property 'save' of undefined

╄→гoц情女王★ 提交于 2021-01-01 07:13:32
问题 I'm trying to show a list of users with react-admin. CustomerList.tsx import React from 'react'; import { TextField, Datagrid, DateInput, DateField, Filter, List, EmailField, SearchInput, SimpleForm, } from 'react-admin'; import { useMediaQuery, Theme } from '@material-ui/core'; import MobileGrid from './MobileGrid'; const CustomerFilter = (props: any) => ( <Filter {...props}> <SearchInput source='q' alwaysOn /> <DateInput source='created_at' /> </Filter> ); const CustomerList = (props: any)

How to reset filter values in react admin framework?

≡放荡痞女 提交于 2020-12-08 06:52:06
问题 I have a filter component: export const PostsFilter = (props) => ( <Filter {...props}> <TextInput label='Post ID' source='id' alwaysOn /> <TextInput label='User ID' source='user_id' alwaysOn /> </Filter> ); I need to add a reset button that will clear input values. I understand that in should be done via dispatching smth to redux. So maybe somebody already solved this problem? Thanks! 回答1: There is a setFilters prop in your filter component, you can use it: export const PostsFilter = (props)