top of page

Forum Posts

chris
May 07, 2019
In Coding with Velo
Hello. If anyone is able to suggest anything I would be very appreciative. Follow this link to view the issue... https://grafixtek.wixsite.com/rohan/animals On this page, when you choose the dropdown options it will appear to work correctly. After enough times of changing the dropdown options you will begin to see that the gallery thumbnails will not update correctly, but if you click on one of the thumbnails to open it in expand mode, you will see that the correctly filtered image will appear eventhough the thumbnail is not correctly filtered. I only have a few lines of code to make this work, see below; import wixData from 'wix-data'; $w.onReady(function () { //TODO: write your page related code here... }); export function animalsDropdown_change(event) { let animalsSubcat = $w('#animalsDropdown').value; $w('#animalsDataset').setFilter(wixData.filter().eq('animalsSubCat1', animalsSubcat)) } I am wondering why after a few times of changing the dropdown options the gallery thumbnails do not filter correctly, but the actual images are displayed correctly in expand mode. To me it seems that the gallery itself is bugged, but I contacted wix support and I was told the problem is in my code in reference to the dropdown. Thank you in advance to whoever you are that can help shed light on this issue. ***UPDATE: I forgot to mention, that in PREVIEW my intended functionality works perfectly... it's only after I PUBLISH and test on the LIVE PUBLISHED site that I get this issue.
0
2
47
chris
May 01, 2019
In Coding with Velo
Hello all. I am trying to auto populate my dropdown from my datacollection, also remove duplicates and list the options in the dropdown in alphabetical order. To this point all is working. However, when I arrive at the page, the gallery, I thought would filter to the first auto pre-populated option in the dropdown, however this is not the case. Any suggestions as to how I can have this page on-load, follow the filter instructions that are set by the dropdown. It works correctly if I manually choose a different option from the dropdown and even go back to the original option, it just does not work on the initial arrival to the page, rather it displays all non filtered content in the gallery. Please know I am not a coder and am learning now with this website. I have been watching youtube and using google to come up with what I have so far. Thank you in advance. Here is the code I have so far...... import wixData from 'wix-data'; $w.onReady(function () { //TODO: write your page related code here... }); //Code to populate the birds dropdown $w.onReady(function () { uniqueDropDown1(); }); function uniqueDropDown1 (){ wixData.query("gallery") .ascending('subCategory2') .limit(1000) .find() .then(results => { const uniqueTitles = getUniqueTitles(results.items); $w("#birdsDropdown").options = buildOptions(uniqueTitles); }); function getUniqueTitles(items) { const titlesOnly = items.map(item => item.subCategory2); return [...new Set(titlesOnly)]; } function buildOptions(uniqueList) { return uniqueList.map(curr => { return {label:curr, value:curr}; }); } } //code to make the dropdown filter the gallery export function birdsDropdown_change(event) { let birdsSubcat = $w('#birdsDropdown').value; $w('#birdsDataset').setFilter(wixData.filter().contains('subCategory2', birdsSubcat)) }
0
0
76

chris

More actions
bottom of page