-1

Im new to wix code. I created a simple database with a title field and some other fields as a test.

I created a text edit box so i can type in a search text, and a grid object so i can see the results.

I connect the grid to the data base and all the fields such as image, description etc.

Then i run the preview mode without typing anything, the grid shows all the table elements.

When i type into the search, even if i type something that is in the table, the grid is blank, seems the filter doesnt work??

Anybody knows why???

here is my code attached to the page

import wixData from "wix-data"

$w.onReady(function () {

});

export function iAddress_keyPress(event, $w) {
    filter($w('#iAddress').value);  // iAddress is the name of the input text box
}

function filter(title) {
    $w('#dataset1').setFilter(wixData.filter().contains('Title',title));
}
lc.
  • 113,939
  • 20
  • 158
  • 187
Nick Buck
  • 21
  • 8

1 Answers1

1

Simple. This is problem:

contains('Title',title)

Title - it's "name" of the column. You should use "field name" from collection, it's displayed when you press "manage properties" on some column - it's actually id.

In your case, "title" is correct field name (as it's default)

Your example will work with this:

contains('title',title)