Here’s my website for reference.
https://www.deafhoosiers.com/search-directory
1. I have mailto: set up in the URL in the database. The email icon is connected to the database and is onClick. I tried to test the icon and nothing is happening. I was expecting a pop up of an email app of any kind to show up. Is there a code I need for that part or am I missing something?
2. The dropdown is showing multiples when I only want one value for each category. I tried several tutorials and am still seeing multiples.
Here’s the code for the page: (please note: there’s a search bar code included and they work)
import {local} from 'wix-storage';
import wixData from 'wix-data';
export function searchButton_click() {
search();
}
export function searchBar_keyPress(event, $w) {
if (event.code === 13){
search();
}
}
function search() {
wixData.query('staffdirectory')
.contains('lastName', $w("#searchBar").value)
.or(wixData.query('staffdirectory').contains('lastName', $w("#searchBar").value))
.or(wixData.query('staffdirectory').contains('firstName', $w("#searchBar").value))
.or(wixData.query('staffdirectory').contains('department', $w("#searchBar").value))
.find()
.then(res => {
$w('#results').data = res.items;
});
}
$w.onReady(function () {
wixData.query("staffdirectory")
.limit(1000)
.find()
.then(results => {
const uniqueItems = getUniqueItems(results.items);
$w("#llisting").options = buildOptions(uniqueItems);
});
function getUniqueItems(items) {
const itemsOnly = items.map(item => item.title);
return [...new Set(itemsOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
});
export function llisting_change(event, $w) {
let sort = $w("#llisting").value;
$w("#staffdirectory").setFilter(wixData.filter().eq("department", sort));
}