-
-
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
Unable to omit specific fields which share the same source #9587
Comments
Thank you for your suggestion. |
Just to give an example, you could have a NumberField to display the value of a foreign key, a ReferenceField linking to the foreign record, and a field that displays a link to some external resource, all using the same source attribute. Another example could be a TextField showing a file name and a custom field that displays an audio player for that file. I suspect there are many examples of these around, they probably just haven't tried to omit one individually. I think another issue is that you can't omit columns without a source. For example, putting an Edit button in the list view, it then can't be omitted by default, even though the user can hide it with the columns button. |
Okay I get your point, thanks for providing additional examples. |
So, the Columns button appears to use the column index. I'm not sure that's going to be a reliable way to implement this feature. Could we maybe extend omit so it matches the label or the source? |
The columns preference is a mix of You have to consider that the feature must still work after the developer changes the number of orer of Fields in the datagrid, given users have already saved preferences. |
Right, so columns is actually the index listed in availableColumns. I'm not sure how that index is kept in sync with developer changes (presumably by checking for columns with the same source or label?). But, availableColumns contains both source and label, which suggests to me that allowing omit to match the label would be a resonable approach? |
No news for some time, closing. |
@fzaninotto I'm still waiting for confirmation that my proposed approach would be accepted... |
I can't tell you if your approach works if you don't provide an implementation ;) I suggest you open a PR, so we can judge on the code. |
Well, I don't want to spend hours creating an implementation if you're just going to say that approach is not acceptable... It shouldn't be difficult to answer yes/no to whether it sounds reasonable that omit could match source or label. As mentioned above, I'm assuming this is what availableColumns is already doing. |
Could you illustrate your suggestion with examples? |
A |
I fail to see how that would work without breaking backwards compatibility. Because developers may define two fields, one with source X and the other with label X. |
I wouldn't expect people to have labels named the same as a different source. Can also put it in v5, so the small break in backwards compatibility is not an issue. |
This is the type of situation react-admin has to deal all the time. So in my opinion, your proposed solution isn't robust enough. |
Is your feature request related to a problem? Please describe.
If there are multiple fields which use the same source (e.g. to render different views of the same data), then it's not possible to omit specific fields from DatagridConfigurable as the omit property works with sources only. Given that they can be individually toggled on/off in the columns selection, it seems reasonable that they should also be configurable individually in omit.
Describe the solution you'd like
Haven't thought of one yet.
The text was updated successfully, but these errors were encountered: