Currently stuck on this. I have a text input bar, button, and a table on my page. I have a DB linked to the table and have this code. It is just pulling straight from the DB to the table not using the search.
import wixData from “wix-data” ;
export function button1_click(event) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
wixData.query( “ProductPricing” )
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
.contains( “id” , $w( “#input1” ).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 () {
$w( “#table1” ).columns = [
{
“id” : “col1” , // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath” : “field1” ,
“label” : “title” , // The column header
“width” : 100 , // Column width
“type” : “string” , // Data type for the column
// Path for the column if it contains a link
“linkPath” : “link-field-or-property”
},];
$w.onReady( function () {
$w( “#table1” ).columns = [{
“id” : “col6” ,
“dataPath” : “id” ,
“label” : “ID” ,
“type” : “string” ,
}, {
“id” : “col7” ,
“dataPath” : “manufacturingcost” ,
“label” : “Manufacturing Cost” ,
“type” : “string” ,
}, {
“id” : “col8” ,
“dataPath” : “duty” ,
“label” : “Duty” ,
“type” : “string” ,
}, {
“id” : “col9” ,
“dataPath” : “freight” ,
“label” : “Freight” ,
“type” : “string” ,
},{
“id” : “col10” ,
“dataPath” : “warehouse” ,
“label” : “Warehouse” ,
“type” : “string” ,
}, {
“id” : “col11” ,
“dataPath” : “shipping” ,
“label” : “Shipping” ,
“type” : “string” ,
}, {
“id” : “col12” ,
“dataPath” : “overheadcost” ,
“label” : “Overhead Cost” ,
“type” : “string” ,
},{
“id” : “col13” ,
“dataPath” : “fulfillment” ,
“label” : “Fulfillment” ,
“type” : “string” ,
}, {
“id” : “col14” ,
“dataPath” : “deliveredcost” ,
“label” : “Delivered Cost” ,
“type” : “string” ,
}];
})
});}