top of page

Forum Posts

Aaron Schultz
Nov 12, 2024
In Wix Classic Editor
I watched the youtube video on creating a search bar for a dynamic page. It was a great video. But I am new to Javascript. I have gotten it to work-ish, but however when the search bar is null or empty, 'after' typing something in it, the repeater contents get scrambled. For some reason it doesn't stay in the order or goes back to the order before the search or the order outlined in the sorting method. After a user clears out the search box after a search is done. Any help or suggestion would be greatly appreciated. Thanks, Aaron import wixData from 'wix-data'; $w.onReady(function () { $w("#magazineRepeater").onItemReady(($item, itemData)=>{ $item("#contents").text = itemData.contents; }) $w("#magazineRepeater").onItemReady(($item, itemData)=>{ $item("#contents").text = itemData.contents; }) async function search() { const query = $w("#searchQueryInput").value; const contentsQuery = wixData.query("MagazineArchives").contains("contents", query); const magDataQueryResults = await contentsQuery .find(); const MagazineArchives = magDataQueryResults.items; $w("#magazineRepeater").data = MagazineArchives; } $w("#searchButton").onClick(search); let throttle; $w('#searchQueryInput').onInput(() => { clearTimeout(throttle); throttle = setTimeout(() => { search(); }, 500); }) }); Before: After:
Help with repeater not refreshing correctly with search bar content media
0
1
7

Aaron Schultz

More actions
bottom of page