Comments (5)
In fact, you can (almost) do it already. Just use <Field>
components inside the <Edit>
view. It'll work, but you'll still have a save button.
We need to make it possible, so I'm tagging that as feature request.
from react-admin.
I've been trying to use the <Show>
view as per example but run into warnings when I include more than one <TextField>
in the <Show>
component:
Warning: Failed prop type: Invalid prop
children
of typearray
supplied toShow
, expected a single ReactElement.
App.js
import React from 'react';
import { jsonServerRestClient, Admin, Resource } from 'admin-on-rest';
import { Delete } from 'admin-on-rest/lib/mui';
import { TaxationList, TaxationCreate, TaxationShow, TaxationEdit } from './views/Taxations';
const App = () => (
<Admin dashboard={Dashboard} menu={Menu} messages={messages} restClient={jsonServerRestClient('http://localhost:3004')}>
<Resource name="taxations" list={TaxationList} create={TaxationCreate} edit={TaxationEdit} show={TaxationShow} remove={Delete}/>
</Admin>
);
export default App;
Taxations.js
export const TaxationShow = (props) => (
<Show {...props}>
<TextField source="id" />
<TextField source="details" />
</Show>
);
When I only include a singular <TextField source="id" />
in <Show>
the ID is shown, but the field styling is not as I would expect.
I'm new to admin-on-rest, so I might be making a rookie mistake. Let me know if I can provide more relevant information.
Thanks
from react-admin.
You didn't look at the example carefully enough: <Show>
expects only one child, which is a layout component.
from react-admin.
@fzaninotto Thanks! Indeed I missed that. I stumbled on the <Show>
component through the Reference, working from the assumption that <Show>
would work like <Edit>
, then missed the details in the commit referenced here.
I suppose the Reference could use a PR with more details about the implementation of <Show>
?
from react-admin.
Great idea!
from react-admin.
Related Issues (20)
- ArrayInput has different behaviour in dev and in build HOT 2
- TextInput or BooleanInput default value not dynamic. HOT 1
- When 'name' field is null , Autocomplete optionText returns error even though i define inputText HOT 2
- TypeScript types are generated with unsafe types because strictNullChecks is false HOT 5
- DateInput, TimeInput, and DateTimeInput are inconsistent HOT 3
- target filters getting merged on using ReferenceManyField for the same reference in different pages HOT 2
- DeleteWithConfirmButton unsafely uses getRecordContext causing runtime error HOT 1
- "Using a Function As <Admin> Child" gives "not assignable to type 'ReactNode'.ts(2322)" with @types/react 18 HOT 4
- Pagination broken with next and previous (reset to 1 everytime) HOT 1
- Unexpected style behaviour on TextInput inside WizardForm component HOT 1
- Test failure caused by [email protected]+ HOT 8
- Pin react-admin ra-* dependencies HOT 2
- SimpleForm isDirty is always true if ArrayInput is used HOT 3
- [RFC] package ra-data-json-server adaption of consistent getMany HOT 1
- TabbedForm crashes if children is an array of react elements HOT 1
- Security Risk, Default install allows request access to all files. HOT 1
- Can not disable ra.action.clear_input_value in SelectInput HOT 1
- Add a meta prop to react-admin reference components HOT 1
- `TextInput` component not handling events during the initial life cycles HOT 4
- combineDataProviders does not support more than 2 parameters in custom dataProvider methods HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-admin.