Hello,
I am trying to get my Dynamic Page to filter by Language. Based on some other posts here I have Added a field ‘language’ to my database and have tried using the following code
import wixWindow from 'wix-window';
import wixData from 'wix-data';
$w.onReady(function () {
let language = wixWindow.multilingual.currentLanguage;
$w("#dynamicDataset").setFilter(wixData.filter().eq("language", language));
});
In the ‘language’ field, I use the language codes (either ‘en’ for english or ‘zh’ for chinese) I have also added a field with the name of each course in English to be used in the URL. (i have also double checked that the #dynamicDataset name is correct on both pages (different names, but correctly typed for both))
On the main courses page with a repeater that shows all the courses, the filtering works fine and if I use the language button to change languages, it will show either English or Chinese correctly and it will change back and forth as many times as I do it.
However, when I applied the same code to my Dynamic page, it seemed to work at first. I was able to change the courses and language at any time and it was showing the correct item. But now it will switch languages but it always shows the same Item for the English entry even if I try to change to other course titles and it will show a different entry (but always the same one) for the Chinese entry.
You can see what I mean if you check out the webpage here: https:// www. fundiverstw .com/courses (sorry, won’t let me post a proper link)
That page will display correctly when you change languages, but when you select through to the individual courses, it doesn’t work correctly…
Any help with this would be appreciated!
Cheers!