Hi all!
I’m currently facing an issue with a dropdown menu on Wix. The dropdown menu is connected to my CMS collection. However, I’m unable to display more than 1,000 items in the dropdown list. Apparently Wix has set a dropdown limit of 1,000 items.
I’ve tried different approaches, but it seems like there are constraints on how many items can be shown at once, and I need to find a workaround to display more than 1,000 items.
Does anyone have an idea how to solve this and/or code this? Your help will be deeply appreciated as I have been struggling with this problem for a long time!
I have already checked out multiple posts on the Wix Forum for a working code, but without success:
top of page
bottom of page
Thank you so much for your help, Eitan!
Hi Daan, Based on your explanation and the examples you shared it seems like the limitation is not built into the dropdown itself but due to the nature of query limits on Wix. When connecting the dropdown with no code its essentially runs a single query for you which has a max limit of 1000 items. In order to get around this you would need to do a recursive query to get all the collection items and then assign them the dropdown with code. Something like:
import wixData from 'wix-data' async function retrieveAllItems() { let results = await wixData.query("myCollection").limit(1000).find(); let allItems = results.items; while (results.hasNext()) { results = await results.next(); allItems = allItems.concat(results.items); } return allItems; } async function populateDropdown(){ const allItems = await retrieveAllItems(); $w("#myDropdown").options = allItems.map((item)=>({ value: item.field1, label: item.field2, }) ) }
I'll add that a dropdown with 1000+ items is probably not the best from a user experience standpoint but technically it would be done as outlined above.
Hope that helps!
Eitan