# Sort on filtered results in repeater

**URL:** <https://forum.wixstudio.com/t/sort-on-filtered-results-in-repeater/36898>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [April 25, 2018, 12:03pm UTC](https://forum.wixstudio.com/t/sort-on-filtered-results-in-repeater/36898 "2018-04-25T12:03:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tailoredwebdesign](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tailoredwebdesign](https://forum.wixstudio.com/u/tailoredwebdesign)\
**Post date:** [April 25, 2018, 12:03pm UTC](https://forum.wixstudio.com/t/sort-on-filtered-results-in-repeater/36898/1 "2018-04-25T12:03:40Z")

</div>

I am using filters for my vacation rental site and it works great:

export function search\_onClick(event, $w) {  
wixData.query(‘Properties’)  
.contains(‘subLocation’,$w(’ [#location](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23location) ‘).value)  
.contains(‘type’, $w(’ [#Type](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23Type) ‘).value)  
.ge(“guests”, Number($w(" [#Guests](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23Guests) “).value))  
.ge(“bedrooms”, Number($w(” [#Rooms](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23Rooms) “).value))  
.ge(“bathrooms”, Number($w(” [#Bathrooms](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23Bathrooms) ").value))  
.find()  
.then(res =\> {  
$w(’ [#repeater2](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23repeater2) ‘).data = res.items;  
$w(" [#button6](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23button6) ").show();  
if (res.items.length === 0){$w(’ [#box3](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23box3) ‘).show();}  
else $w(’ [#box3](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23box3) ').hide();  
});  
}

What I would like to do is have a sort by price descending & ascending.  
This code works perfectly:

export function dropdown1\_change(event, $w) {  
if ($w(’ [#dropdown1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dropdown1) ‘).value === ‘high’)  
$w(" [#dataset1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dataset1) ").setSort(  
wixData.sort()  
.descending(“price”));  
if  
($w(’ [#dropdown1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dropdown1) ‘).value=== ‘low’)  
$w(" [#dataset1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dataset1) ").setSort(  
wixData.sort()  
.ascending(“price”));  
if  
($w(’ [#dropdown1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dropdown1) ').value=== ‘none’)  
$w(" [#dataset1](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dataset1) ").setSort(  
wixData.sort()  
);  
}

However, it works only on the **unfiltered data**. I would like users to be able to sort before they do any filtering (which is how it works now) but then also sort the filtered results in the repeater after they have refined their search with the above. Im guessing it would be similar to the res.items but not sure…

Can you please let me know how I would go about that? Thank you!!

---

<div class="post-metadata">

**Author:** ![tailoredwebdesign](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tailoredwebdesign](https://forum.wixstudio.com/u/tailoredwebdesign)\
**Post date:** [April 26, 2018, 1:38pm UTC](https://forum.wixstudio.com/t/sort-on-filtered-results-in-repeater/36898/2 "2018-04-26T13:38:08Z")

</div>

Can anyone help please? @Yisrael, @Sam, @Roi, @Tal…

---

<div class="post-metadata">

**Author:** ![cassiecarledge](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/cassiecarledge/32/13871_2.png) [@cassiecarledge](https://forum.wixstudio.com/u/cassiecarledge)\
**Post date:** [August 9, 2019, 3:33am UTC](https://forum.wixstudio.com/t/sort-on-filtered-results-in-repeater/36898/3 "2019-08-09T03:33:31Z")

</div>

Has this been solved yet?
