Crumpled Fabric

0

Save Search/Filter

Click URL to copy

Aug 11, 2021

1 min read

WIX Ideas Team

Tags: Velo by WIX User Interaction WIX Data Repeater Filter

👋🏽Hello WIXer,


Do you want your users to save part of their filters on searchbars or dropdowns?


Then this is the right place for you 🙂


In this tutorial, you will learn how to insert values from your filter elements into your user's Local Storage (Which can be saved for as long as possible in their browser), and then when they visit that page the values will be selected by default and so will the filter.

To accomplish this, we use the 'import { local } from 'wix-storage';' library.



Saved Search on browser's local storage


I USED THE FOLLOWING APIs FOR LOCAL STORAGE🎉


  1. local.setItem("key", "value") - To save the item in local storage

  2. local.getItem("key") - To retrieve saved item from local storage

  3. local.removeItem("key") - To delete saved item from local storage


TO FILTER USING SAVED ITEM FROM LOCAL STORAGE 🚀


In order to filter the repeater automatically, I added the wixData.query function within the $w.onReady function. This will allow the filter to run when the elements in the website are loaded.


PRETTY MUCH THAT 🤩


The flow goes from the user selecting a value to filter, then the value is saved in their local browser, now when the user refreshes or revisits the same page, the value is pre-selected on their filter element and the repeater will be filtered automatically.


THANK YOU FOR READING, YOU ARE AMAZING 😍




Code



LEAVE A COMMENT

WRITE A COMMENT

Thanks for leaving a comment🎉

Walter

Walter

8/8/22

More Details? Watch video

Hi, you can click here to watch the video https://www.youtube.com/watch?v=9bx7-nBeZ5c

Walter

Walter

7/11/22

For you

Walter Odibi

Walter Odibi

4/18/22

Awesome Feature

This tutorial shows you how to display views on your Wix repeater.

📺WATCH VIDEO HERE https://www.youtube.com/watch?v=Iz7SdaCSdXg

Walter Odibi

Walter Odibi

4/18/22

Amazing tutorial

This amazing tutorial will show you how to a comment section to your WIX dynamic page.

📺WATCH VIDEO HERE https://www.youtube.com/watch?v=f8-vJQFNZ_c

Walter Odibi

Walter Odibi

4/10/22

Great Feature🎉

This amazing tutorial will show you how to add a visitor view counter to your WIX dynamic page.

🚩MORE TUTORIALS https://www.wixgenius.com/wix-tutorials

LOAD MORE 🎉

RELATED TUTORIALS 🚀

Add Like to WIX Dynamic Page

Add Like to WIX Dynamic Page

Learn how to add a "LIKE" counter to your dynamic page.

Multiple Database Field Search

Multiple Database Field Search