Hi, I've been using Wix for just about a month, I am trying to figure out how to code this. 1. If the input box is empty. show Image1 & hideRepeater1 2. if text is inputted, hide image1 & show repeater1, The inputted text in the input box will filter the items in the repeater. Done with the filtering.
the problem is if the input box is empty, it just shows the whole data from the database. Thanks in advance. here's my code
import wixLocation from 'wix-location' import wixData from 'wix-data'; $w.onReady(function () { $w("#input9").show(); $w("#button19").hide(); $w('#repeater1').hide(); });
export function input9_keyPress(event) {
let input = $w("#input9").value;
$w('#image1').hide("fade");
$w('#repeater1').show("fade");
$w("#dataset1").setFilter(wixData.filter().contains('viberPost', input));
}
Sorry was on my phone instead of the pc, this should show repeater when there is input
and hide the image
when there is no input it hide the repeater and shows the inputµ
if $w("#input9").value !== ""){
$w("#image1").expand()
$w("#repeater1.collapse()
} else {
$w("#image1").collapse'()
$w("#repeater1").expand()
$w("#dataset1").setFilter(wixData.filter().contains('viberPost',$w("#input9").value))
}
what you can do is collapse it. its the same as hidding it, except evrything under it will go up so you don't have empty spaces where the element is collapsed. you also don't have to refresh the screen by doing so. add this to your onChange() function from the inputfield
if $w("#input9").value !== ""){
$w("#image1").collapse()
$w("#repeater1.expand()
} else {
$w("#image1").expand'()
$w("#repeater1").collapse()
$w("#dataset1").setFilter(wixData.filter().contains('viberPost',$w("#input9").value))
}
I suspect you will need to force a screen refresh