# Alphabetical Database list not alphabetical on site!

**URL:** <https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [January 22, 2018, 12:19am UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001 "2018-01-22T00:19:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian-cuz](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ian-cuz/32/1664_2.png) [@ian-cuz](https://forum.wixstudio.com/u/ian-cuz)\
**Post date:** [January 22, 2018, 12:19am UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001/1 "2018-01-22T00:19:33Z")

</div>

I am using Database to generate a list of items.  
When I ‘Preview’ the items on my site, they appear either in reverse alphabetical order or in any other random order.  
I have then tried a simple Database with six items in the first column, these items being: the letters A, B, C, D, E, F. I have then generated a page and when I preview they are in reverse alphabetical order or in any other random order.  
I cannot remedy the issue.  
HELP !!!

---

<div class="post-metadata">

**Author:** ![ian-cuz](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ian-cuz/32/1664_2.png) [@ian-cuz](https://forum.wixstudio.com/u/ian-cuz)\
**Post date:** [January 22, 2018, 12:26am UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001/2 "2018-01-22T00:26:36Z")

</div>

Someone has suggested ‘I could always code it’. I am not sure what this means…?

---

<div class="post-metadata">

**Author:** ![shlomi-shemesh](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@shlomi-shemesh](https://forum.wixstudio.com/u/shlomi-shemesh)\
**Post date:** [January 22, 2018, 2:28pm UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001/3 "2018-01-22T14:28:46Z")

</div>

Hi Ian,

when using wix-data to query this collection, please also use sort. in different situation you may also want to display the data sorted differently

> **[wix-data - Velo API Reference - Wix.com](https://www.wix.com/velo/reference/wix-data)**
>
> The wix-data module contains functionality for working with data in collections.

Shlomi

---

<div class="post-metadata">

**Author:** ![macabongo](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/macabongo/32/5927_2.png) [@macabongo](https://forum.wixstudio.com/u/macabongo)\
**Post date:** [June 18, 2019, 2:02pm UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001/4 "2019-06-18T14:02:47Z")

</div>

Hello, I solved the problem by placing the data in alphabetical order, I then created an enumerated column, and I passed the following code as an example:

**function** loadBAIRROS() {  
wixData.query(‘BAIRROS’)  
.ascending(“ordem”)  
.limit(60)  
.find()  
.then(res =\> {  
**let** options = [{  
“value”: ‘’,  
“label”: ‘Selecione um Bairro’  
}];  
options.push(…res.items.map(bairro =\> {  
**return** {  
“value”: bairro.bairros,  
“label”: bairro.bairros  
};  
}));  
$w(‘#iBairro’).options = options;

```
    }); 

```

}

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [June 18, 2019, 2:48pm UTC](https://forum.wixstudio.com/t/alphabetical-database-list-not-alphabetical-on-site/20001/5 "2019-06-18T14:48:39Z")

</div>

If you are simply using a table, repeater or gallery etc to show info from a dataset on your page, then you can simply set the filter for the dataset’s own field that you want to organise it all by.  
[https://support.wix.com/en/article/about-filtering-and-sorting-database-content-displayed-in-page-elements#sorting-your-dataset](https://support.wix.com/en/article/about-filtering-and-sorting-database-content-displayed-in-page-elements#sorting-your-dataset)

The default sort order is the date the item was added, with newer items appearing first. This date appears in the “Date\_Created” system field. When you add a new sort, the default sort disappears.

If we continue our example from the above link, we want the recipes to be listed alphabetically by recipe name. So our **field** would be “Recipe,” and our **order** would be “A-Z.” The image on the link shows how this looks.

If it is search on a dataset that is shown in a table or a repeater, then you can just use simple code like this.

```javascript
import wixData from 'wix-data';

$w.onReady(function () {

export function button_click(event) {
let value = $w("#input").value;
let filter = wixData.filter();
$w("#dataset").setFilter(
filter.eq("type", value)
);
}

```
