I’m building a band recruitment website that features a student portal whereby individuals can create a profile and upload an audition video, and a director’s portal whereby individuals can search those profiles for relevant matches. I’ve created the database and linked all relevant fields (save the upload video button which, I am told, does not currently allow the uploading of videos into the database; is there a solid workaround to this?). My issue comes when I try to perform the subsequent search. Following the steps in one of the wix tutorials, I created a dropdown box and connected it to both my dataset and the relevant field. I then created a table and connected it to my dataset. Unfortunately, the two don’t seem to be talking to each other. I need to create more dropdowns for more filter options, which I think I can do once I get this first one figured out. The code I’m using is:
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixData from ‘wix-data’;
export function dropdown1_change(event, $w) { // Runs a query on the “Members” collection
wixData.query(‘Student_Records’)
// Query the collection for any items whose “Name” field contains
// the value the user selected in the dropdown
.contains(‘instruments’, $w(‘#sInstrument’).value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w(‘#table1’).rows = res.items;
});
}
/*$w.onReady(function () {
//TODO: write your page related code here…
$w("#table1").columns = [
{
"id": "col1", // ID of the column for code purposes
// The field key in the collection whose data this column displays
"dataPath": "firstName",
"label": "First Name", // The column header
"width": 100, // Column width
"visible": true, // Column visibility
"type": "string", // Data type for the column
// Path for the column if it contains a link
"linkPath": "link-field-or-property"
},
{
"id": "col2",
"dataPath": "lastName",
"label": "Last Name",
"width": 100,
"visible": true,
"type": "string",
"linkPath": "link-field-or-property"
},
{
"id": "col3",
"dataPath": "classification",
"label": "Classification",
"width": 100,
"visible": true,
"type": "string",
"linkPath": "link-field-or-property"
},
{
"id": "col4",
"dataPath": "city",
"label": "State",
"width": 100,
"visible": true,
"type": "string",
"linkPath": "link-field-or-property"
},
{
"id": "col5",
"dataPath": "state",
"label": "State",
"width": 100,
"visible": true,
"type": "string",
"linkPath": "link-field-or-property"
},
{
"id": "col6",
"dataPath": "video",
"label": "Video",
"width": 100,
"visible": true,
"type": "video",
"linkPath": "link-field-or-property"
}
]
});
}*/
I commented out the table portion because I was told that it was conflicting with the code previous. When I run a preview, and instrument I choose from the dropdown shows up in the Instrument field of the table, but that’s all that shows up. The test data I input into my student form was for a trumpet player, however, when I select trumpet from the dropdown, the word “trumpet” shows up in the field, but none of the other data of record does. Admittedly, javascript aint my thing, so I’m confused as to what is and isn’t happening.