-
-
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
<DatagridConfigurable omit=... does nothing #8817
Comments
Not sure this is really a bug but rather a misunderstanding: the |
Sorry, I forgot to include that in the steps. I deleted everything from localStorage when testing several times (I think it automatically deleted on logout as well). |
When I toggle the columns as a user, it also stores the current state in |
I'm sorry but I don't reproduce the issue. Now, I agree that the documentation on this feature is still quite poor, hence I'll label this issue as documentation so that we try to improve it. To answer your other questions, the value of This prop is useful because it acts as a kind of default value when you clear the preferences for the ConfigurableDatagrid using the InspectorButton (see screenshot below). |
Not sure how easy it is for you to run Python, but this is the actual code: It should be possible to run with something like:
Then go to http://localhost:8080/admin I'll try and include the InspectorButton (hadn't got that far through the documentation yet) and see what happens when that is used. |
Yep, same result with InspectorButton, when clicking the reset button it resets to all columns showing, despite the setting in the storage still appearing as I can't run the example you linked as it seems to need several GBs of RAM that I don't have spare currently, so my system crashes before it finishes loading. |
You need to understand that we receive multiple issues each day, so it would be impossible for us to take the time needed to run and debug custom projects for each issue. If there is really an issue with the Since all of the tests I have performed so far do confirm the component is working as expected, I won't investigate any further on this issue unless you manage to reproduce it inside our sandbox. |
Yep, I know. I don't get paid to maintain the dozens of projects I'm involved in, so I probably have even less time. :P Seems that I was just on the verge of RAM usage, managed to free up a little more and got it running. I've copied the code in and then hacked the code a little to use a fake API and skip some checks. That seems to have reproduced the issue again: |
I'm sorry but your sandbox looks nothing like the simple example anymore, so it's impossible to see what you have changed in it. Besides it throws many errors and warnings at runtime, e.g. What you are asking us here is basically to debug your code, instead of providing evidence there is a bug in the library. Please note that having a member of our team help debug your application is possible though, by purchasing Professional Services. As such, I'll close this issue, and invite you to either resort to Professional Services, or provide a clear evidence that you found a bug coming from react-admin. |
OK, finally had time to break this down further. The problem appears to be:
It works correctly if I add
I don't see any mention of So, I'm not sure how I was supposed to know that was required (but, maybe I missed something elsewhere in the documentation?). |
That's because the https://marmelab.com/react-admin/Datagrid.html#usage The same goes for If you use |
Hmm, not quite. It says that it uses So, it seems that it requires |
Right, I'm reopening the issue to investigate further. |
The documentation for the Configurable datagrid clearly says:
React-admin needs to match these sources with the field sourcs. If you define a custom field without source, there is no way it can work. In other words, if you want to use So I'm closing this issue as we won't fix it. |
Right, but why not include I guess this also means that omit as a feature is limited to only columns that map to a field? e.g. There's no way to omit the edit button column in my original example. |
@Dreamsorcerer you can wrap any custom component into a component that accepts a |
I've reread the 2 lines of documentation and example more than a dozen times to see if I'm missing some detail, but the omit prop just doesn't seem to do anything.
What you were expecting:
The columns listed in omit to be hidden by default and the SelectColumnsButton to show them as hidden.
What happened instead:
Nothing. It still renders the columns exactly the same as not using the omit prop.
However, I can see the omit value appears in local storage, which suggests I correctly used the omit prop.
Steps to reproduce:
I don't have a simple reproducer, as the project builds everything from a JSON schema, but the actual code to create the component is:
With a console.log() I can see that
resource["list_omit"]
is set to["value", "num"]
in my test example.I can also see in local storage, there is a new setting with the key
RaStore.preferences.simple.datagrid.omit
and value["value","num"]
. So, it appears to be set correctly. However, both of those columns are still displayed by default.Other information:
Documentation: https://marmelab.com/react-admin/Datagrid.html#configurable
Environment
The text was updated successfully, but these errors were encountered: