-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support fields from associations #376
Comments
Hi @maxmarcon and thank you for the issue! I am currently using full text search if you had a user table with first name and last name the generated query would look something like this for search (I searched for "siob") SELECT count(u0."id")
FROM "users" AS u0
WHERE (
to_tsvector('english', coalesce(first_name, ' ') || ' ' || coalesce(last_name, ' ') ) @@ to_tsquery('siob:*')
) The search part of the query that I use is constructed here in the Line 174 in 4bab00e
What I am thinking is that we could add an optional module/template option for What do you think @maxmarcon ? Do you have the bandwidth to work on a PR? |
Hi @alanvardy and thanks for the response. I like your idea, it's quite flexible and also in line with how other functionalities can currently be customized by the dev. One comment: we will also need to provide an "escape hatch" for sorting. Right now the name of the column is used directly in the query: Line 112 in 4bab00e
I don't have the bandwidth for a PR right now, but I might find the time in a few weeks. Stay tuned. |
Hi!
This looks like a cool library. Thank you so much for writing it! I think this is something that is badly needed in Elixirland. I was planning to use it until I (alas!) found a show stopper in my use case scenario.
I have a schema with associations, and I would like to show the main schema fields along with some fields from the associations, and make them searchable and sortable.
For example:
In my Exzeitable table, I'd like to show both the user's name as well as their organization's names. I was able to make it work with this:
This allows me to display the organization's name just fine 👍 However, the field can't neither be sorted or searched because Exzeitable generates the search and sort queries assuming that
org_name
is a field of theuser
schema 👎It seems to me that some support for associations would be in order here. I haven't thought carefully about the details, but maybe it would be enough to implement an
association
option for fields. Something like:That way, Exzeitable would know that it would have to preload the
organization
association and use itsname
field as the value of theorg_name
field in the table. It might work, but as I said, I haven't thought it through.Anyway, let me know what you think.
The text was updated successfully, but these errors were encountered: