So I followed the tutorial here and I have managed to implement the search functionality and it seems to be working, however, a new issue is now popping up.
The collection I want to link the table to has names in one column (this is what I am trying to search) and links to different websites in the other (the URL I want to be able to click on). If I dynamically link the table then the links work, but as soon as I include the search functionality as described in the tutorial above I can no longer open up the URLs. I am new to JS so any help would be much appreciated!
I have tried using TableMaster, however, my collection is fairly long and changes very often. This makes entering the data and adding hyperlinks by hand very tedious and if I import a CSV or google sheet then the URL does not work for some reason.
I have also tried to rather search by URL, but that did not work either.
Here is the code I am using at the moment.
import wixData from "wix-data";
$w.onReady(function () {
$w("#ResultsTable").columns = [{
"id": "col1",
"dataPath": "title",
"label": "Club Names",
"type": "string",
}, {
"id": "col2",
"dataPath": "URL",
"label": "URLs",
"type": "url",
}];
});
export function page1_click(event) {
// Runs a query on the "Websites" collection
wixData.query("Websites")
// Query the collection for any items whose "Name" field contains
// the value the user entered in the input element
.contains("title", $w("#Search").value)
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#ResultsTable").rows = res.items;
});
}