# Sorting a table help

**URL:** <https://community.weweb.io/t/sorting-a-table-help/6009>\
**Category:** How do I?\
**Created:** [December 19, 2023, 2:58pm UTC](https://community.weweb.io/t/sorting-a-table-help/6009 "2023-12-19T14:58:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/oli/32/8397_2.png) [@oli](https://community.weweb.io/u/oli)\
**Post date:** [December 19, 2023, 2:58pm UTC](https://community.weweb.io/t/sorting-a-table-help/6009/1 "2023-12-19T14:58:18Z")

</div>

Hi there, new to WeWeb and really liking it so far. I’m trying to add a front end sort button to a table, and I can see there are a few guides in the forums but they’re mostly using a slightly out of date UI (I think?). It looks like there’s now a “sort” button built in.

What I’ve done:

I’ve created an icon that can change the variable sortbyemployees to either “Asc” or “Desc”. This seems to work when I click it (ie it toggles the variable back and forth)

Now if I go to my table and use the “Sort” button, I’ve set it to sort number\_of\_employees by the current value of sortbyemployees (ie Asc or Desc)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/5a09e4203361ce3b5c6040aba1d451c884636492.png)

But when the variable changes the sort order does not. Sorry I can’t post more screenshots as a new user ☹

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [December 19, 2023, 3:13pm UTC](https://community.weweb.io/t/sorting-a-table-help/6009/2 "2023-12-19T15:13:10Z")

</div>

Try all uppercase: `ASC` and `DESC`

---

<div class="post-metadata">

**Author:** ![oli](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/oli/32/8397_2.png) [@oli](https://community.weweb.io/u/oli)\
**Post date:** [December 19, 2023, 4:10pm UTC](https://community.weweb.io/t/sorting-a-table-help/6009/3 "2023-12-19T16:10:16Z")

</div>

Beautiful, worked like a charm. Thank you!
