Hello Tal,
One more guidance needed please!
I have a dynamic page, which displayed data extracted from database, based on user input, perfectly! Now, this database also has a document field, how do I connect this data being displayed in table element with the document filed so that it can be downloaded?
The table element here is not connected with the database and is accessed and displayed through code only.
Following is the code am using
import wixData from ‘wix-data’;
//1. The collection to be search is named ‘JudgmentNotes’.
//2. The field in the collection to be search is named ‘held’.
//3. Search button’s ID is ‘searchButton’.
//4. Table component is ‘resultsTable’
//5. Search input component’s ID is ‘searchInput’
export function searchButton_onClick(event) {
//create a variable that will hold the search value.
//get that value from the search input component.
let searchValue = $w(‘#searchInput’).value;
//build a query for the 'JudgmentNotes' collection
wixData.query('JudgmentNotes')
//add a 'contains' condition to the query.
//have the query look in the 'held' field.
//instruct it to look for the search value the user typed.
.contains('held', searchValue)
//actually run the query
.find()
//when the query returns:
.then(res =>
{
//get the items found from the result set
//place the results in a variable called 'foundItems'
let foundItems = res.items;
//now find the table component and make it display the results.
$w('#resultsTable').rows = res.items;
});
}
//-----------------------
export function partySearch_onclick(event) {
//Add your code for this event here:
//create a variable that will hold the search value.
//get that value from the search input component.
let searchValue = $w(‘#partyInput’).value;
//build a query for the 'JudgmentNotes' collection
wixData.query('JudgmentNotes')
//add a 'contains' condition to the query.
//have the query look in the 'held' field.
//instruct it to look for the search value the user typed.
.contains('title', searchValue)
//actually run the query
.find()
//when the query returns:
.then(res =>
{
//get the items found from the result set
//place the results in a variable called 'foundItems'
let foundItems = res.items;
//now find the table component and make it display the results.
$w('#resultsTable').rows = res.items;
});
}
With the ‘title’ Field Key, I need the ‘document’ Field Key connected.
Please guide, how to go about it.