I’ve got a Searching page that you can search in the position table.
The problem is that when you searching by the “תחום” (which describe as ‘#selection1’ in the code ), you cant get the correct position.
Same problem with searching by the “אזור” (which describe as ‘#selection6’ in the code ).
Thanks!
It’s looks like this -
// חיפוש לפי דרופ דאון של תחום ואזור
export function selection1_click(event) {
wixData.query(‘PositionsManagement’)
.contains(‘title’, $w(‘#selection6’).value)
.contains(‘title’, $w(‘#selection1’).value)
.find()
.then(res => {
$w(‘#table2’).rows = res.items;
});
Hi Hadar,
Instead of using the Wix-Data API, I recommend filtering the table using regular JS code, and set the table rows with the new filtered data. In order to do so, please follow the instructions below:
I noticed that you called the filterTable function here:
Instead, you should create an onChange event (clicking the plus sign) and call the function from inside the onChange event function (as explained above, at the third step).
As a general note, I recommend giving meaningful names to the elements instead of leaving the default names so that it’ll be easier for you to understand the code and fix bugs when there is a need.
I duplicated the page (" Copy of כל המשרות ") and corrected it so it works now. I saved the changes and haven’t published it. Please go through the code and let me know if anything is unclear.
Hi Tal,
Thanks for providing this solution. My only other question is where do i insert this code (what line)? I’ve attached a copy of my search page code below.
// Runs a query on the “tenant database” collection
wixData.query(“Tenant_Blacklist”)
// Query the collection for any items whose “Name” field contains
// the value the user entered in the input element
.contains(“tenantFullName”, $w(“#input7”).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”: “tenantFullName”,
“label”: “tenantFullName”, // 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”
},
{
“id”: “col2”,
“dataPath”: “photos”,
“label”: “photos”,
“visible”: true ,
“type”: “image”,
“linkPath”: “link-field-or-property”
},
{
“id”: “col3”, // ID of the column for code purposes
// The field key in the collection whose data this column displays
“dataPath”: “scoreOutOf10”,
“label”: “scoreOutOf10”, // 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”
},
Hi all, can someone help me filter the search bar. I need to do “search by state”, just wondering how would that work. Happy to pay. Please contact 6178991966 or liyuele@bu.edu.