I would like to use a User Input (Radio button or Drop Down) to change a dynamic page to the content I select. The Radio button or drop down would be on the dynamic page. Example: I have peoples names and info about them in the database, I made a field that has the letter of the person last name in it. I would like the Radio button or drop down to switch to the letter selected so it would only pull up the info associated with that letter. I have a repeater on the dynamic page. Is this possible?
Hi Dach212000 and welcome to Wix Code.
It is possible.
This is my suggestion:
- Add a Radio button/Drop down component, and set their values
- Use “onChange” event and set new filter
import wixData from 'wix-data';
export function RadioGroup1_onChange(event, $w) {
const radioButtonValue = event.target.value;
$w('#yourDataset').setFilter(wixData.filter()
.eq("FieldKey", radioButtonValue) // "eq" equals the specified value, more methods are available.
)
.then((res) => {
console.log('works');
})
.catch((err) => {
const errMSG = err;
})
}
It should rerender the repeater with the new data.
For more information:
Good luck!
Thank You