Search in a Repeater

Hi Guys,

I am trying to follow along with this youtube video. However, when test out the code, my repeater disappears? Is someone able to point me in the right direction please!

import wixData from ‘wix-data’;

export function PatientSearchFirstName_keyPress(event, $w){
filter($w(‘#PatientSearchFirstName’).value)
}

function filter(title) {
$w(‘#SkinRiskAssessmentD’).setFilter(wixData.filter().contains(“FirstName” , title))
}

Thanks,
Mark

Hello Mark,

The code you posted is good syntax wise, so I can only guess the problem is that you took the field label instead of the field key from the database. The field key is grayed out if you view the properties of a field in the collection, and never starts with a capital letter, so instead of “FirstName”, it should probably be “firstName”. This is just a guess and you should look at your field key to get the correct value.

Here is the field properties, in this case we want the field key; find this in your collection and replace “FirstName” with the actual key.

Best,
Majd

1 Like

it worked!! Thanks Majd, it has been frustrating me all day as Javascript is new to me.

import wixData from ‘wix-data’;

export function PatientSearchFirstName_keyPress(event, $w){
filter($w(‘#PatientSearchFirstName’).value)
}

function filter(title) {
$w(‘#SkinRiskAssessmentD’).setFilter(wixData.filter().contains(“title” , title))
}

Anytime Mark, glad to help :slight_smile:

Outstanding, exactly the issue I was having. Thank you, even if this is an old thread. No one has a clue, but you do, and had an answer.

wayne