react-admin

Mount react-admin under /admin

孤人 提交于 2021-02-19 03:37:28
问题 I simply want all of my admin pages to be under /admin . <Admin title="Admin" dashboard={Dashboard} dataProvider={restClient} history={history} > <Resource name="users" list={UserList} /> </Admin> My main page is at /admin but when I click Users in the sidebar, it changes the path to /users and not /admin/users . I'm using react-admin 2.0.0. 回答1: The key is actually in the history prop passed to the Admin component: import createHistory from 'history/createBrowserHistory'; const history =

How do I slow down my express server response to allow the react-admin getOne() function to work?

♀尐吖头ヾ 提交于 2021-02-15 07:52:04
问题 I have created VetCreate and VetEdit functions to create a new record and then edit that record respectively (code below). The problem I have is the successful create response is returned but the newly created id isn't populated in the request to fetch the record. I have async/await keywords in place where I think they need to be but the details logged to the console clearly indicate something isn't working as it should. If I try to edit a record after returning to the list screen, the API

How to display a custom page from a custom (non crud, custom data) json

自古美人都是妖i 提交于 2021-02-11 14:26:33
问题 I was able to create a simple admin panel using react-admin 3.x (migated from 2.x) and as data provider the jsonServerProvider. Now I'd like to have a custom page showing some custom data. Say I have a json like this: { "title":"My custom page", "teaser":"This is a custom page showing some stuff", "drinks":[{"name": "coke", "image": "coca-cola.jpg"}, {"name": "beer", "image": "beer.png"}, {"name": "coffee", "image": "cappuccino.jpg"}], "additional_stuff": ["some", "more", "stuff"] } I

ReferenceInput is not filing the select component

老子叫甜甜 提交于 2021-02-11 13:11:10
问题 In React-admin i am trying to implement a referenceinput. I see that the list api call is made and response is availble. however the selectinput component remains empty. I would appreciate any help. Table source column is notes . and reference resource is notes : <Create actions={<CoaActions />} title="New Coa" {...props}> <SimpleForm variant="standard"> <TextInput source="code" /> <TextInput multiline source="title" /> <TextInput source="iscashbook" /> <TextInput source="isbankbook" />

Custom layout in SimpleForm component on react-admin

一笑奈何 提交于 2021-02-07 13:44:04
问题 I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm> . Simply like this If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error. Warning: React does not recognize the `basePath` prop on a DOM element. If you intentionally want it to appear in the DOM as

Custom layout in SimpleForm component on react-admin

安稳与你 提交于 2021-02-07 13:43:02
问题 I want to create a custom two-column-grid layout on my react-admin project on Edit and Show pages. I want to display selectboxes and the imageupload area on the left column, and the text inputs on the right column by using only one <SimpleForm> . Simply like this If I use a div or a <Card> component under <SimpleForm> and <EditController> components, I receive an error. Warning: React does not recognize the `basePath` prop on a DOM element. If you intentionally want it to appear in the DOM as

How to change SaveButton icon in React-Admin

别等时光非礼了梦想. 提交于 2021-01-29 13:46:53
问题 Looks like the component has the icon hard-coded(That icon that looks like a floppy disk), is there no way to pass in an icon as a prop and have it render that one instead? Is there an easy way to do this for specifically React-Admin components? 回答1: This will be possible in the next major version: 2.5.0 (see https://github.com/marmelab/react-admin/pull/2556). Until then, you can implement your own button using material-ui by looking at the code (https://github.com/marmelab/react-admin/blob

CheckboxGroupInput is not showing previous saved checkboxes

喜夏-厌秋 提交于 2021-01-29 07:44:54
问题 When I edit an item, I want to get the previous checked referenced choices. The options are shown well, but are always all unchecked. It save any changes I do, though. It works the same with CheckboxGroupInput as well with AutocompleteArrayInput. ReferenceArrayInput is sending this array of data to CheckboxGroupInput: 0: {id: 1, company-name: "Empresa 1", created_at: "2019-08-09T18:08:18.066Z", updated_at: "2019-08-28T13:17:02.474Z", …} 1: {id: 3, company-name: "Empresa 3", created_at: "2019

Attempted import error: 'ReactReduxContext' is not exported from 'react-redux'

扶醉桌前 提交于 2021-01-29 03:01:12
问题 I am trying to setting up a new react-admin console (following the offcial tutorial : https://marmelab.com/react-admin/Tutorial.html). The current version of react-admin is 3.3.1. But when execute command yarn start the following error occured : ./node_modules/ra-core/esm/core/CoreAdminContext.js Attempted import error: 'ReactReduxContext' is not exported from 'react-redux'. What can I do ? 回答1: Delete your yarn lock / package lock and yarn install . As per this thread The problem comes from

Auto Calculate Input Fields

喜夏-厌秋 提交于 2021-01-28 20:14:06
问题 Please could someone help answer this: I have 2 NumberInput controls, one input and the other is disabled. I need to input number in the first input field, the disabled field to show this number/100. The two NumberInput will have source fields that will save to the current record in the simpleform. How do I do this in react-admin Thanks 回答1: Easiest way is to use the method described in the docs under section Linking two inputs In essence: You can create your own input component where you can