Wix Data API & Results Table Row Help

Good evening all,

I need a little assistance if someone very kind wouldn’t mind helping me:

I have put together a database which visitors can search by selecting options from a drop down box and by entering text in to an input box.

This populates the table successfully by clicking on a button and I have got the table to expand. Now i’m trying to display multiple results/queries in rows which I haven’t grasped yet.

The code I have so far is:

import wixData from “wix-data”;

export function GetPricesNowButton_click_1(event, $w) {
// Runs a query on the “Pricing-Data” collection
wixData.query(“Pricing-Data”)
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
// the value the user selected in the dropdown
.contains(“wasteType”, $w(“#dropdown7”).value)
.contains(“postCode”, $w(“#Searchbox1”).value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w(“#priceTable”).rows = res.items;
$w(“#priceTable”).expand();
});
}
$w.onReady( function () {
$w(“#priceTable”).columns = [{
“id”: “postCode”,
“dataPath”: “postCode”,
“label”: “Post Code”,
“type”: “string”,
}, {
“id”: “wasteType”,
“dataPath”: “wasteType”,
“label”: “Waste Type”,
“type”: “string”
}, {
“id”: “lowestBinPriceAvailable”,
“dataPath”: “lowestBinPriceAvailable”,
“label”: “Lowest Bin Price”,
“type”: “string”,
}, {
“id”: “alternativeSolutionsAvailable”,
“dataPath”: “alternativeSolutionsAvailable”,
“label”: “Alternative Solutions?”,
“type”: “string”,
}, {
“id”: “image140”,
“dataPath”: “image140”,
“label”: “Bin Size”,
“type”: “image”,
}, ];
});

What I would like to have displayed is for additional rows of results of ‘wasteType’, so the visitor would have say 10 separate options as an example, each one searches for the waste type and post code and displays the collection/database results on the next row underneath.

.contains(“wasteType”, $w(" #dropdown7 “).value)
.contains(“postCode”, $w(” #Searchbox1 ").value)

Thanks in advance for any input,

Kind regards
James

Hi all, just to say I resolved the issue and the problem was that I wasn’t presenting the data in the table in the best format for it to then display in rows. Thanks.