Help with Datatable search

I have copied and pasted everything Yoav said about the matter and I still cannot seem to make a search for my database can anyone help?

Hi Chaim!

Make sure that other than copy + paste you adjust the components reference names in the code to the ones you use in your site.

If you still encounter issues with this, feel free to share a link to your site so one of us, Wix Code Team, can inspect it and provide you with a solution.

Doron :slight_smile:

// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixData from ‘wix-data’;

$w.onReady( function () {
$w(“#table1”).columns = [{
“id”: “col1”,
“dataPath”: “services”,
“label”: “avalible”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}, {
“id”: “col2”,
“dataPath”: “imageURL”,
“label”: “image”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}, {
“id”: “col3”,
“dataPath”: “serviceName”,
“label”: “Name”,
“width”: 100,
“visible”: true ,
“type”: “string”,
}];
});//TODO: write your page related code here…

export function button1_click(event, $w) {
// Runs a query on the “Members” collection
wixData.query(‘Bookings/Services’)
// Query the collection for any items whose “Name” field contains
// the value the user selected in the dropdown
.contains(‘serviceName’, $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(‘#table1’).show();
});

}

This is the code I wrote, the results show but it does not filter properly

I would share my site but how can I do it privately?

Hi Chaim!

Only authorized authorized personnel can inspect your site if you share a link to your editor.
While we can see your editor, others will get a 404 error page.

Doron. :slight_smile:

http://wix.to/5ECrAFg

Am not sure why I am not able to add a table, I was working on a copy of this site
I have added a user input and the code, if you can figure it out thanks!

Hi!

I need a link to your site and not to a feedback page.
Please share a link either to your published site or to your editor.

Doron.

Chrental.com
Thanks

Hi Chaim!

After looking at your site and what I assume is the correct page that you’re referring to (‘real estate agents’) I can see that you use references to elements that doesn’t necessarily exists in your page.

Make sure that if you use in your code a reference to an element called ‘$w(“#table1”)’ you actually have it in your page and that all the elements Id’s are correctly called.

Please let us know if you still facing issues with it after making the needed adjustments.

Doron.

Hi, As I mentioned in my comments that is not the issue (I was testing the code on a copy site with the table) I was not able to see the table in the userinput… I have added a table now, again the issue is it does not filter all it does it show all the items in the database Services.

What I would like to do is create search bar (sort of like the hotel search bar which would have categories and filters which a customer would be able to find each service and on each page have a filter for price…