我们正在将AOR(版本1.2.3)与现有应用程序集成。 当我们给出时,我们正试图提供编辑功能 < ---场及GT;组件工作正常 也能看到SAVE按钮 但 当它< ---输入>组件 没有SAVE按钮可见,而Component确实接受输入。
代码何时 使用字段组件
import React, { Component } from 'react';
import {
Components
} from 'admin-on-rest';
const CustomerEdit = (props) => (
<Edit {...this.props}>
<TabbedForm>
<FormTab label="Profile">
<TextField source="firstName" />
<TextField source="middleName" />
<TextField source="lastName" />
</FormTab>
<FormTab label="Address">
<ReferenceManyField addLabel={false} reference="CustomerAddresses" target="customerProfileId">
<Datagrid>
<EditButton/>
<TextField source="id" />
<TextField source="line1" />
<TextField source="pinCode" />
</Datagrid>
</ReferenceManyField>
</FormTab>
</TabbedForm>
</Edit>
);
export default CustomerEdit;
&#13;
代码何时 输入 使用组件
import React, { Component } from 'react';
import {
Components
} from 'admin-on-rest';
const CustomerEdit = (props) => (
<Edit {...this.props}>
<TabbedForm>
<FormTab label="Profile">
<TextInput source="firstName" />
<TextInput source="middleName" />
<TextInput source="lastName" />
</FormTab>
<FormTab label="Address">
<ReferenceManyField addLabel={false} reference="CustomerAddresses" target="customerProfileId">
<Datagrid>
<EditButton/>
<TextInput source="id" />
<TextInput source="line1" />
<TextInput source="pinCode" />
</Datagrid>
</ReferenceManyField>
</FormTab>
</TabbedForm>
</Edit>
);
export default CustomerEdit;
&#13;
这是App.js
import React from 'react';
import PropTypes from 'prop-types';
// redux, react-router, redux-form, saga, and material-ui
// form the 'kernel' on which admin-on-rest runs
import { combineReducers, createStore, compose, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import createHistory from 'history/createHashHistory'
import { Switch, Route } from 'react-router-dom'
import { ConnectedRouter, routerReducer, routerMiddleware } from 'react-router-redux';
import { reducer as formReducer } from 'redux-form';
import createSagaMiddleware from 'redux-saga';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
// prebuilt admin-on-rest features
import {
adminReducer,
localeReducer,
crudSaga,
TranslationProvider,
} from 'admin-on-rest';
import restClient from './restClient';
import GenericList from './ui/List';
import CustomerEdit from './ui/views/customer/customerEdit';
const reducer = combineReducers({
admin: adminReducer([{ name: 'CustomerProfiles' },
{ name: 'CustomerAddresses' }]),
locale: localeReducer(),
form: formReducer,
routing: routerReducer,
});
const sagaMiddleware = createSagaMiddleware();
const history = createHistory();
const store = createStore(reducer, undefined, compose(
applyMiddleware(sagaMiddleware, routerMiddleware(history)),
window.devToolsExtension ? window.devToolsExtension() : f => f,
));
sagaMiddleware.run(crudSaga(restClient));
const App = () => (
<Provider store={store}>
<TranslationProvider messages={messages}>
<ConnectedRouter history={history}>
<MuiThemeProvider>
<Switch>
<Route exact path="/profile"
hasCreate render={
(routeProps) => <GenericList resource="CustomerProfiles" {...routeProps} />
} />
<Route exact path="/profile/:id"
hasEdit render={
(routeProps) => <CustomerEdit resource="CustomerProfiles" {...routeProps} />
} />
</Switch>
</MuiThemeProvider>
</ConnectedRouter>
</TranslationProvider>
</Provider>
);
export default App
&#13;
这是在Field Component
的情况下答案 0 :(得分:0)
请勿在控制台中发现有关ReferenceManyInput
的错误消息?该组件不存在。
我检查了文档,我们确实将其包含在Resources chapter中。它很快就会修好。
要引用许多其他资源,您应该使用ReferenceArrayInput。但是,它不支持Datagrids。目前还没有允许您编辑相关资源的组件。