This query used to work to search with just the zip code. , but then I made some changes and it stopped working . It does not display any table result, or the console log message. Ultimately I wan to use the zip code as a required search term and the store as an optional search term, but was trying to get it working with the just the zip code first.
Thanks!
import wixData from ‘wix-data’;
export function button1_onClick(event) {
// export function button1_click(event, $w) {
wixData.query(‘Shopper’)
.contains(‘shopperZipcodes’, $w(‘#input1’).value)
.find()
.then(res => {
console.log(‘found zip code’)
// let foundItems = res.items;
$w(‘#table1’).rows = res.items;
$w(‘#table1’).show();
});
}
$w.onReady( function () {
$w(“#table1”).columns = [
{
“id”: “col1”, // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath”: “shopperImage”,
“label”: “This Is Me”, // The column header
“width”: 100, // Column width
“visible”: true , // Column visibility
“type”: “image”, // Data type for the column
// Path for the column if it contains a link
//“linkPath”: “link-field-or-property”
},
{
“id”: “col2”,
“dataPath”: “shopper_name”,
“label”: “My Name Is”,
“width”: 100,
“visible”: true ,
“type”: “string”,
//“linkPath”: “link-field-or-property”
},
{
“id”: “col3”,
“dataPath”: “shopperStores”,
“label”: “I Shop At”,
“width”: 100,
“visible”: true ,
“type”: “string”,
//“linkPath”: “link-field-or-property”
},
{
“id”: “col4”,
“dataPath”: “shopperAboutMe”,
“label”: “About Me”,
“width”: 100,
“visible”: true ,
“type”: “string”,
//“linkPath”: “link-field-or-property”
},
{
“id”: “col5”,
“dataPath”: “phone”,
“label”: “Mobile Number”,
“width”: 100,
“visible”: true ,
“type”: “string”,
//“linkPath”: “link-field-or-property”
},
{
“id”: “col6”,
“dataPath”: “email”,
“label”: “Email Address”,
“width”: 100,
“visible”: true ,
“type”: “string”,
//“linkPath”: “link-field-or-property”
}];
});