-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: Unify layout behavior. #67391
Comments
By creating a "special bundle" of primary/media/description, this also simplifies conceptually what's the "main click target" of the layout. It was perhaps already clear in grid and list, but not in table — anything could be a target there. This situation with table has created issues and forced us to add a {
primaryField: "something"
mediaField: "something"
descriptionField: "something",
onClick: "action",
otherFields: [ ]
} The layout declares which action will be triggered upon clicking primary/media fields. In the |
Could this be made optional and dependent on providing a primary field? It'd also be good if the media and description fields were optional.
This would simplify things but I would also need a way to disable it for certain rows. Return early in the callback works ok but it'd be better if the on click hover/cursor styling was correct too. Funnily enough, I happen to be working on a concrete example where this proposed |
I guess if you provide only regular fields and don't assign any primary/media nor description field, the first column won't be rendered here. That said, I would love to understand more the use-cases where there's no "primary column". Could you share a bit more?
Personally I don't think the "onClick" action should be part of the "view" object. The view object should always stay a serializable object that you can persist and share in the backend.
If you need something like that, I think it's always a good idea to share the use-case so we can understand better what's the right solution for it. |
What do you mean here? |
@ntsekouras The screenshot above is the only place where we currently use the "columns" config. We can easily remove that by making the "description" a special field to achieve the same result. We may also remove that unnecessary "description" label in the same change. |
Just thinking generally, if there are going to be requirements on this field like not being able to reorder it, then there might be scenarios where you just want to display a table of data.
WordPress.com/sites dashboard, deleted sites in the list of sites need to be shown but they don't have on any click behavior, only a restore action. |
Makes sense there's an |
Ah, thanks, looks like we need to update 😄 |
Current the list, grid and table layouts work very differently when it comes to "fields". This is the result of multiple requests to achieve some designs. So we have:
These differences created some friction and downsides:
I think it's time to take a look at the designs we achieved using these features and see whether we can do the same by altering our approach a little bit.
The main idea is to unify how all the layouts work with the following config:
Related #57596 #58012
The text was updated successfully, but these errors were encountered: