# Collapse / Expand Repeater based on the value of a text user input

**URL:** <https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [February 4, 2021, 11:46am UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277 "2021-02-04T11:46:29Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [February 4, 2021, 1:36pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/21 "2021-02-04T13:36:09Z")

</div>

@diavele  
And the only thing now you want to do is that when the user types something  
the repeater collapses while typing,  
when done the repeater can expand again?

---

<div class="post-metadata">

**Author:** ![diavele](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@diavele](https://forum.wixstudio.com/u/diavele)\
**Post date:** [February 4, 2021, 1:37pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/22 "2021-02-04T13:37:27Z")

</div>

@volkaertskristof if the text value is null the repeater must be collapsed. if value is “title” (hero name) repeater must expand to show the result.

---

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [February 4, 2021, 1:38pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/23 "2021-02-04T13:38:43Z")

</div>

Oke so not showing when only part is typed?

---

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [February 4, 2021, 1:39pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/24 "2021-02-04T13:39:15Z")

</div>

I got this far with you, i will help till evrything works 😃

---

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [February 4, 2021, 1:47pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/25 "2021-02-04T13:47:57Z")

</div>

Past the code you have now,  
I’ll try to change it the way it should work then

---

<div class="post-metadata">

**Author:** ![diavele](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@diavele](https://forum.wixstudio.com/u/diavele)\
**Post date:** [February 4, 2021, 2:03pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/26 "2021-02-04T14:03:58Z")

</div>

@volkaertskristof This worked. It solved everything.

* * *

```javascript
$w.onReady(function () {
      $w("#dataset1").onReady( () => {
} );
});

//search bar
import wixData from 'wix-data';

let debounceTimer;

export function input1_keyPress(event) {
 if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = undefined;
    }
    debounceTimer = setTimeout(() => {
        filter($w('#input1').value);
    }, 0);
}

let lastFilterTitle;
function filter() { 
$w('#dataset1').setFilter( 
wixData.filter() 
.contains("title", $w("#input1").value) 
.and( wixData.filter()
) 
);

if($w("#input1").value === ""){

$w("#repeater1").collapse()

} else {

$w("#repeater1").expand()

}
}

```

---

<div class="post-metadata">

**Author:** ![volkaertskristof](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/volkaertskristof/32/18158_2.png) [@volkaertskristof](https://forum.wixstudio.com/u/volkaertskristof)\
**Post date:** [February 4, 2021, 2:28pm UTC](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277/27 "2021-02-04T14:28:45Z")

</div>

@diavele ah good to hear!  
If you have any other question  
Don’t hesitate to ask.

[Previous page](https://forum.wixstudio.com/t/collapse-expand-repeater-based-on-the-value-of-a-text-user-input/2277.md?page=1)
