Closed smonff closed 5 years ago
Setting x-list-columns
isn't required, but the heuristics that Yancy uses to guess what to display in the list (if you don't set x-list-columns
) are crude at best: Right now, it looks for columns named 'id', 'name', 'username', 'title', or 'slug'.
My best idea for how to guess what columns to display is to display the first 4-6 columns that do not have "format": "textarea"
or "format": "markdown"
. These columns are the most likely to break the list view (though, perhaps with some CSS, white-space: nowrap; text-overflow: ellipsis
, we could keep things looking nice even with large amounts of text).
I've added a warning to the editor when the list only shows a single column that isn't a string (so, if it's showing an auto-increment id
field), but if someone comes up with some better heuristics for guessing columns to show in the list, I'd be happy to accept it.
Thanks for the explanations and the hard work @preaction.
I'll open a new ticket for better x-list-columns
heuristics.
Hi,
I use Yancy in a
Mojolicious::Lite
application throughMojolicious::Plugin::Yancy
. The SQLIte database schema is :And the app configuration is :
Everything works fine this way, as long the
x-list-columns
parameters is available: if I remove it, the web page only display a list ofid
fields, but other fields are not display, despite they are returned by the Yancy API.I report this, dunno if this is a bug or the expected behavior with maybe a lack of documentation? I assumed
read_schema => 1
was able to "auto-list" all the collection fields, so that's why I think this behavior seems strange: I mean, by reading synopsis and various parts of the documentations (and trying different things many times), I was always having this problem and never found a place asking to explicitly setx-list-columns
but always useread_schema
.If this is not a bug and that
x-list-columns
is required, I guess it should be specified more evidently. I volunteer to send a documentation PR.Mojolicious 8.06
Yancy 1.018
Mojo::SQLite 3.001
Thanks!