Filter Dropdown Options Distinctly Not Working For Repeater

Hello,

I followed the tutorial on adding dropdown filtering to a database. I had to alter the code for a repeater instead of a table. The load options distinctly function isn’t working. Line 69 has a parsing error. How do I fix this?

Tutorial I followed: https://support.wix.com/en/article/corvid-tutorial-adding-collection-data-search-functionality

Thanks for any help in advance!

Here is my code:

import wixData from "wix-data";

export function searchBox_keyPress(event) {
  wixData.query("Listings")
 // Query the collection for any items whose "Name" field contains  
 // the value the user entered in the input element
    .contains("street", $w("#searchBox").value)
    .find() // Run the query
    .then(res => {
 // Set the table data to be the results of the query     
      $w("#repeater1").data = res.items;
    });
}

export function dropdown1_change(event) {
  wixData.query("Listings")
 // Query the collection for any items whose "Name" field contains  
 // the value the user selected in the dropdown
    .contains("city", $w("#dropdown1").value)
    .find() // Run the query
    .then(res => {
 // Set the table data to be the results of the query
      $w("#repeater1").data = res.items;
    });
}

function loadOptions() {

 // Run a query that returns distinct items in the collection
  wixData.query("Listings")

 // Set the course as the field that must be distinct
    .distinct("city")

    .then(results => {

 // Call another function to reformat the distinct items
 // the way the dropdown element expects
 let distinctList = buildOptions(results.items);

 // Use `unshift()` to add another dropdown option at 
 // the beginning of the array, in the correct format
      distinctList.unshift({ "value": '', "label": 'All Cities' });

 // Set the options of the dropdown 
      $w("#dropdown1").options = distinctList;

    });

}

function buildOptions(dropdownItems) {
 return items.map(currentItem => {
 return {
 "label": "currentItem",
 "value": "currentItem"
    };
  });
}

$w.onReady(() => {

  loadOptions();

  $w("#repeater1").data = [{
    ...  //This is the line I'm getting error                                   
    ...
    ...

  }];

});

Have you read this page from Yisrael about inputs in repeaters?
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-input-repeaters

Also, have a read of Repeater from the Wix API reference as well if you are wanting to populate it through it’s data properties.
https://www.wix.com/corvid/reference/$w.Repeater.html

Plus, whilst there read the onItemReady and forEachItem sections too.
https://www.wix.com/corvid/reference/$w.Repeater.html#onItemReady
https://www.wix.com/corvid/reference/$w.Repeater.html#forEachItem

If you are just trying to filter a repeater with a dropdown, then have a look at these simple tutorials already out there for doing such a thing.
https://www.youtube.com/watch?v=r0DLqkRDJ34
https://www.vorbly.com/Vorbly-Code/WIX-REPEATER-WITH-MULTIPLE-FILTERS
https://www.vorbly.com/Vorbly-Code/WIX-CODE-CLEAR-REPEATER-DATA
https://www.vorbly.com/Vorbly-Code/WIX-REPEATER-MULTIPLE-FILTERS-WITH-RESET
https://www.youtube.com/watch?v=E8W3nTazcNo

Also, note that the tutorial is built and written for working with tables and not repeaters, hence this section in the tutorial too.

3. Define the table columns

Because your table isn’t connected to a dataset, you need to define the columns using the API for tables . You do this by defining a JSON object that lists the properties for each column and their values. The code is placed in the onReady function and looks like this:

Thanks! Yes, but I’m new at code. I’m still a little confused. Is it possible to help me with the code that I already have? I just need to change the onready portion at the end…