react-admin

react-admin - How to set input values based on another

…衆ロ難τιáo~ 提交于 2019-12-30 08:52:07
问题 i'm trying to create a ZIP code input that loads street, state and city values automatically in a Create form using React-Admin. How can I populate the inputs based on the onBlur event of the zip code input? The best result i achieved is the following scenario: I created a custom component that has 4 Inputs: zip code (in my country is called CEP), street address, state and city. Then I added an onBlur event on the zip input and set the value on the inputs based on state attributes. Here is

How to use a custom reducer's state as a permanent filter in a <List>?

こ雲淡風輕ζ 提交于 2019-12-24 20:15:30
问题 I have a custom reducer and a connected component to change its state. Now I'd like to use this state as a permanent filter on List elements. I understand the List elements are connected to the redux-state, so I hope I'm able to access it through the List component's props, but couldn't find a way how to do that. 回答1: The List component is connected but not yours. import { connect } from "react-redux"; const MyList = ({ is_published, ...props }) => ( <List {...props} filter={{ is_published }}

How to unselect checkboxes after bulk action execution?

一个人想着一个人 提交于 2019-12-24 10:37:33
问题 On a List module, I created a bulk action button to generate PDF by calling a custom action. The problem is <Datagrid> checkboxes are not unselected once the action is executed. Here is my custom action: export const print = (resource, ids, data) => ({ type: DOWNLOAD, payload: { id: ids.length === 1 ? ids[0] : ids, data, }, meta: { resource: resource, fetch: PRINT, onFailure: { notification: { body: 'ra.notification.http_error', level: 'warning', }, }, }, }); And here is my button: class

How to Loopback Remote api response load in react admin datagrid

元气小坏坏 提交于 2019-12-24 08:59:56
问题 i am using loopback 3 developed api load into react admin using react admin loopback package.my doubt is i am write remote api id based get list of values in my response.its result how to load react admin datagrid. This i am try to load into my react admin based on react admin loopback.this standard template id passed to my template page.this id based call the api and load into datagrid.i dont know? how to pass the api in datagrid http://localhost:3000/api/templates

How can all CRUD actions of a resource by linked to a particular foreign key?

做~自己de王妃 提交于 2019-12-24 08:56:46
问题 Version: Next (react-admin) Resources Classes and Students . "Students" has a foreign key to "Classes": class_id . So, in the List of Classes we have for each row (class) a button "View/Edit Students of Class". When we click on this button, we have this code: <Button label={'View/Edit Students of Class'} onClick={(e) => { localStorage.setItem('classId', record.id); history.push({ pathname: 'students', search: stringify({ page: 1, perPage: 25, sort: 'createdOn', order: 'DESC', classId: record

showNotification in react-admin doesn't work

人走茶凉 提交于 2019-12-24 08:07:08
问题 1. Call from lifecycle callbacks. I have the code like bellow: // app.js <Admin> <Resource name="FooList" list={FooList} /> </Admin> // FooList.js class FooList extends React.Component { componentDidMount () { showNotification("foo") } } export default connect(null, {showNotification})(FooList) When component get mounted, an error in console appeared: Warning: React does not recognize the `showNotification` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom

How to dynamically change the “title” of “app”, based on login info (i.e. after login succeeds or logout)?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 02:32:41
问题 I have this code, please see the title prop: const App = () => ( <Admin theme={theme} customRoutes={customRoutes} menu={Menu} dataProvider={loopbackRestClient(window.apiUrl)} authProvider={authClient()} dashboard={Dashboard} locale="en" i18nProvider={i18nProvider} title={`Dashboard - ${window.accountData ? window.accountData.accommodation.name : ''}`} > // more code here... This tries to change the rendered title when login succeeds and therefore we get different accommodation.name value from

Nested Reference Field

时间秒杀一切 提交于 2019-12-21 20:49:13
问题 In order to retrieve the equipment type I am using a that will retrieve the equipment model and then another that references the equipment type using the equipment model's field "typeID" to retrieve the equipment type. However it displays the following warning: Warning: Failed prop type: Invalid prop translateChoice of type boolean supplied to ReferenceField, expected function. The image represents the data model (an equipment has an equipment model, and an equipment model has an equipment

React Admin displays very messed up

点点圈 提交于 2019-12-19 07:22:35
问题 My RA project renders fine when deploying locally, however, when I copy my build directory to an S3 bucket for deployment, it renders all messed up. Sometimes it works, but most of the time it renders like the below image. It works fine in both environments with AOR. Environment React-admin version:2.0.3 Last version that did not exhibit the issue (if applicable): React version:16.4.1 Browser:Chrome/Safari 回答1: There is an issue with the production build if you have a different version of

MaterialUI, how to overwrite styles of nested MUI component?

只谈情不闲聊 提交于 2019-12-13 02:57:40
问题 I am using react-admin and I am using their Create component that use TextField from @material-ui/core . Of course I have read the documentation here I would like to completely customize the render for a custom view, this is how look the generated html: <div class="create-page Component-root-55" notification=""> <div class="MuiPaper-root-58 MuiPaper-elevation1-61 MuiPaper-rounded-59 MuiCard-root-57 Component-card-56 Create-card-53"> <form class="simple-form" locale="en"> <div class=