WixData.setFilter() seems not work :(

Hello guys,

I have a DB with just 3 collections and one of the column is a relational table which has 2 columns: InstituteName and DepartmentName, which references InstituteName and DepartmentName in their proper collections.

Anyhow, I have this codelogic in the dataSet.onReady() function, to filter the specified Insitutenames before the category-grid is load, so that when it is load, its just load with the correct filtered data, but this code here:

let currentInstituteName = local.getItem(‘instituteName’); //works
let instHasSomeDepts = $w(‘#InstHasSomeDeptsSet’); //works

instHasSomeDepts.setFilter(wixData.filter().eq(‘InstituteName’, currentInstituteName)); //doesnt work

doesnt work!

Pls help, I really cant get around, why it doesnt work :frowning:

Best regards

–shho

One thing I see is that you need to use the collection Field Key , and not the Field Name .
You can find the Field Key like this:

Not this:
instHasSomeDepts.setFilter(wixData.filter().eq(‘InstituteName’, currentInstituteName));

But this:
instHasSomeDepts.setFilter(wixData.filter().eq(‘instituteName’, currentInstituteName));

Notice that a field key starts with a lower-case letter, and not upper-case.

Good luck,

Yisrael

First of all, thx for the fast response, but I tried that and it still doesnt filter :confused:

Actually there are 2 issues here:

  1. it shows the items but they dissaper after a second
  2. the one i posted

Do I need to change something in the DB collections or the like?

Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.

ok ,here; https://editor.wix.com/html/editor/web/renderer/edit/85cac4ae-4f16-40e5-a6c4-b739a73ce5f7?metaSiteId=9b7d4c99-95d4-4d48-a5f6-41916bf5c8fa&editorSessionId=FC56004E-B78D-4AA1-8AB7-B9CD539E98C6&referralInfo=my-account

I opened up your site in the editor and I’m afraid that you are not using dynamic pages correctly. I would suggest reading the documentation on Dynamic Page . If you then have specific questions, we would be glad to help you.

Yisrael

How I am using it, is enough for my purpose so far, and it seems that you couldnt find out what is the problem?

For me, this looks straight like a bug.

The thing btw is, it worked pretty well 2 days before. So it cant have anything to do with my use of the dynamic-category pages, because it shows everything fine for me so far.

So I please you, I really need help on this, he doesnt filter anything out of the sudden :frowning: