Skip to content

Computed values in list views #75

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

Open
Svashta opened this issue Jun 17, 2024 · 8 comments
Open

Computed values in list views #75

Svashta opened this issue Jun 17, 2024 · 8 comments

Comments

@Svashta
Copy link

Svashta commented Jun 17, 2024

Hey, I am new to Directus and this extension obviously, and I am trying to display a computed value in the list view. Is that possible? I am able to see the correct value in the details view, but I would also need it in the list.

It could be I am doing things wrong fundamentally, not fully understanding inner workings of Directus itself.

Simple example.
I have a students collection, student having name and surname fields.
What I would like to do is to show their full name (combining name and surname).
It is not as important to have it on the details view, where i already have name and surname, but in the list view (specially in the one-to-one associations) it is something i am aiming for.

I could not find a way to do it with Directus OOTB, so i was looking into this extension.
Sorry for this question if it is not the right place to ask about.

@dpitch
Copy link

dpitch commented Jul 16, 2024

Yes same problem here

@ulysse-lacour
Copy link

Same see here

@JoshuaCWebDeveloper
Copy link

JoshuaCWebDeveloper commented Aug 3, 2024

Yup it looks like computed alias values don't support being rendered in tables and lists. However, computed values that are stored in the database are correctly shown in tables, so a workaround for this issue is to store the computed value in the database by deselecting Field Mode under Interface.

Note: I have to edit an item (just open and save) in order to get the value of the computed field to update in the database.

@ulysse-lacour
Copy link

Thank you very much ! It's indeed working, any hack to hide the field from detail page but still use it in list ?

@dpitch
Copy link

dpitch commented Aug 4, 2024

the hack would be to use the classified group plugin. Put the computed field inside a classified group field.
Add the css class "hide" to the classified group field.
Then in the custom CSS,
.hide{
display : none!important;
}

@ulysse-lacour
Copy link

Wonderfull thanks seems pretty straightforward, will give it at try!

@ulysse-lacour
Copy link

Silly beginner question but what would be best practice for adding custom css ?

@dpitch
Copy link

dpitch commented Aug 5, 2024

it's in settings( perhaps under theme I don't remember), search for "custom css" in the settings and just paste :
.hide{
display : none!important;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants