Quick Search/Filter Content link Columns in the CMS

Hi,

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?

Thanks in advance,
Ricky.

Currently on my mobile, so can’t test myself at the moment, but did you use “populate” as well?

Hey @witsec, thanks for the quick feedback.
I’m new to Cockpit, can you further explain how I can use the “populate” param?

The populate field is used on linked content and is used by Cockpit how deep to dig when fetching content.

If the field in the collection you’re searching links to a field in another collection, simply put “populate” to 1 and see how that plays out.

Try this in the API builder inside the CMS, to easily test this feature.

Does that do what you’re after?

Hi again @witsec,

I’m trying to filter the collection inside the Cockpit CMS dashboard and not via the API. Check the following image:

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 :slight_smile:

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.

Hey @witsec, once again thanks for the help!

That’s too bad, I was really hoping that it would be possible :cry:
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 :frowning_face:

Sorry, not possible yet. Also not easy to implement with a document based data storage but I’ll add this on my todo list

Hey @artur, thanks for the feedback.

It would be a really useful feature. So, looking forward for some news in the near future :stuck_out_tongue:

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 :wink:.

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?

Hey @witsec,

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):

image

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 :slight_smile:

Sorry, I didn’t read one of your earlier posts properly, you mentioned this before. I didn’t realize you wanted this in the Cockpit frontend.

Hey @witsec, no problem :slightly_smiling_face:
Hopefully this will be an improvement for the near future, right @artur? :wink: