firecmsco / firecms

Awesome Firebase/Firestore-based CMS. The missing admin panel for your Firebase project!
https://firecms.co
Other
1.12k stars 184 forks source link

Filter and Sort for different keys #636

Closed nivlempert1 closed 3 months ago

nivlempert1 commented 3 months ago

Hi there,

I've been trying to implement filtering and sorting with different keys, but I'm facing a challenge. Whenever I try to select one, it toggles off the other in the UI.

In my case, I got two keys- "id" and "created", I need to filter "id" by equality and sort by "created" date.

I followed the instructions in "Multiple filters in collection views," which involved adding firestoreIndexesBuilder and implementing the indexes in Firestore. However, despite these efforts, the UI won't allow me to select both filter and sort simultaneously.

The only workaround I found is hard-coding initialFilter and initialSort, but that's not flexible.

Do you have any suggestions on how I can achieve this functionality seamlessly?

fgatti675 commented 3 months ago

Hi, what version of FireCMS are you using?

nivlempert1 commented 3 months ago

tried it in both v2.2 and the latest v3

fgatti675 commented 3 months ago

So you deployed to FireCMS Cloud?

nivlempert1 commented 3 months ago

tried it locally

fgatti675 commented 3 months ago

got it, can you post your code so I try to reproduce it?

nivlempert1 commented 3 months ago

I just followed that guide: https://firecms.co/docs/collections/multiple_filters The thing is I can't see any comment about sorting + filtering. Is that supposed to work?

fgatti675 commented 3 months ago

It is probably working as expected. Could you try doing your requested query in a script and see if it works?

nivlempert1 commented 3 months ago

Thats a video of my problem- I can only choose sort or filter, not both of them. Does it even supposed to work for both of them? https://github.com/firecmsco/firecms/assets/29779843/a29050b1-45a2-4038-a1b3-2fc03c7537fd

fgatti675 commented 3 months ago

Hi! we have done an update in the latest version. The package name has changed from firecms to @firecms/cloud and the version is 3.0.0-beta.4. Give it a try, now it should work as you expect

nivlempert1 commented 3 months ago

Wow thank you so much! you solved it!