-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SelectColumns and DatagridConfigurable #8274
Conversation
02640c8
to
c4511f7
Compare
packages/ra-ui-materialui/src/list/datagrid/DatagridConfigurable.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WiXSL Right. I'm not sure how to solve this, though. Any suggestion? |
…le.tsx Co-authored-by: Aníbal Svarcas <WiXSL@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to be annoying here, but I tried a simple show hidden column
functionality with a DatagridConfigurable
and it doesn't show the column at all even when the config hasn't been touched yet.
The exact same code works, replacing DatagridConfigurable
with Datagrid
// In ra-ui-materialui/src/list/datagrid/DatagridConfigurable.stories.tsx
export const Basic = () => {
// State to show column
const [show, setShow] = React.useState(false);
return (
<PreferencesEditorContextProvider>
<MemoryRouter>
<Inspector />
<Box display="flex" justifyContent="flex-end">
<InspectorButton />
</Box>
<Box p={2}>
<Button
onClick={() => {
setShow(true);
}}
>
Show
</Button>
<DatagridConfigurable
resource="books1"
data={data}
sort={{ field: 'title', order: 'ASC' }}
bulkActionButtons={false}
>
<TextField source="id" />
<TextField source="title" label="Original title" />
<TextField source="year" />
{show === true && <TextField source="author" />}
</DatagridConfigurable>
</Box>
</MemoryRouter>
</PreferencesEditorContextProvider>
);
};
I'm not sure I understand your remark. What's the use case for that? |
Let's say a user uses permissions to show or hide a particular set of columns, plus now wants to have a |
Let's say that we're not supporting this for now ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 💪
Enregistrement.de.l.ecran.2022-10-18.a.11.45.14.mov
<DatagridConfigurable>
component<DatagridConfigurable>
story<DatagridConfigurable>
tests<DatagridConfigurable>
documentation<SelectColumnsButton>
component<SelectColumnsButton>
story<SelectColumnsButton>
tests<SelectColumnsButton>
documentationmemoryStore.removeItems
Closes #7973