Search Feature

I am using the following code to enable search function, however the code is not working. It is showing no result:

Can you please advice

import wixData from ‘wix-data’;
$w.onReady(function () {
});
export function button1_click() {
wixData.query(‘Member’)
.contains(‘Name’, $w(‘#input1’).value)
.find()
.then(res => {
$w(‘#table1’).rows = res.items;
});
}

Hi Dipesh,

Welcome to WixCode.

I tried a quick experiment and I was able to do a simple search and populate a table using your code.

So, I have some questions:

  • Are the table column names the same as the column names in the collection?

  • You are searching for the collection field “Name”. Does that exist in the collection? Is that also the name of a column in the table?

  • When you input a search value is it written exactly the same as the value you are searching for in the collection? That is, upper-case, lower-case, spelling…
    Please show how your table is defined.
    Please show how your collection is defined.

Yisrael

Thanks, I was making a silly mistake…Instead of database column ID, I am using the Column Name. Now working fine. I have one more query:
Search also show an image which is stored in the database, but it is appearing very small. How can i see the full image (original size)