I’ve created a collection that is likened to another collection via a Content link field. Every thing is working as expected, but I when I do a quick search/filter in the collection table from the CMS it doesn’t work with the Content Link column. It only works with the “normal” text fields of the collection.
Is is possible to include the Content Link column value in the quick search/filter?
The “Categoria” column is linked to a collection, and when I try to do a search in the table, I’m not able to filter results based on that column.
Is it possible to use the “populate” param in this case? If yes, where can I do that?
Once again sorry for the questions, but I’m learning Cockpit on the go
Hmm, I don’t know if you can filter on a content link / populated item. I tried a lot, but I can’t get it to work well. I can filter on the “_id” of a linked item, like so (in my example):
{ "category._id": "6f5d12bd633166b2eb0001df" }
But if I try to filter on its name, that doesn’t seem to work, even with “populate” set to 1:
{ "category.catname": "Media" } ← doesn’t work
I hope someone with more/better knowledge about this subject will drop by.
If this just isn’t an option, perhaps you can fetch the ID of the linked content item and pass that in the filter, in which case the first example should work just fine.
That’s too bad, I was really hoping that it would be possible
Not being able to filter by the linked collection field is going to be a pain because there will be hundreds of items withing dozens of categories.
Any more ideas I can try?
The only alternative I can come up with is to break this collection into separate collections for each category, but that will mean dozens of collections to manage in the CMS
For now you could think of finding an easy way to get the “_id” of the linked content item, so you can use it in your search filter.
For example, if you have a collection “posts” and a collection “categories” and inside posts you have a content link “category”. And let’s say on your website you have a pulldown with categories (or links to categories if you will), you can then pass the ID and use it in your filter.
Another way is to first filter for the name of, in my case, the category inside the categories collection to retrieve the _id, then do a filter on posts using found _id on the category content link - if that still makes sense .
So there are workarounds that could benefit you greatly. If you don’t think this suits your needs, what’s the context of your project?
What I would like is to use the current filter input field of the collections table to search for connection link column values.
The following image is from Cockpits CMS. It’s a collection table that has a connection link to a another collection called “Categorias”. The only thing that I’m trying to achieve here is use the search input field to filter for values in the “Categoria” column (connection link):
In short, I want to filter connection link column values inside of Cockpit’s backoffice application.
Regarding your suggestions, those are approaches that I can do on the future frontend application via the Cockpit API