# Table using user input data

**URL:** <https://forum.wixstudio.com/t/table-using-user-input-data/35663>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [May 3, 2018, 7:02pm UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663 "2018-05-03T19:02:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_matt-7](https://avatars.discourse-cdn.com/v4/letter/_/ed8c4c/32.png) [@\_matt-7](https://forum.wixstudio.com/u/_matt-7)\
**Post date:** [May 3, 2018, 7:02pm UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/1 "2018-05-03T19:02:21Z")

</div>

When a user inputs data in a form and i have it set up to build a table with that information, is it possible to make the table headings sortable? for example lets say 10 people fill out my form and i want to sort the table by home state, is there a way to do this?

---

<div class="post-metadata">

**Author:** ![elizabethjhay](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@elizabethjhay](https://forum.wixstudio.com/u/elizabethjhay)\
**Post date:** [May 3, 2018, 11:14pm UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/2 "2018-05-03T23:14:20Z")

</div>

Matt do you want the user to be able to sort it or do you want to have a set sort on the table?

---

<div class="post-metadata">

**Author:** ![\_matt-7](https://avatars.discourse-cdn.com/v4/letter/_/ed8c4c/32.png) [@\_matt-7](https://forum.wixstudio.com/u/_matt-7)\
**Post date:** [May 4, 2018, 12:23am UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/3 "2018-05-04T00:23:53Z")

</div>

yes, the user to sort

---

<div class="post-metadata">

**Author:** ![elizabethjhay](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@elizabethjhay](https://forum.wixstudio.com/u/elizabethjhay)\
**Post date:** [May 4, 2018, 12:30am UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/4 "2018-05-04T00:30:36Z")

</div>

Try these two resources. They worked for me when I had a table on my site.

[![](https://us1.discourse-cdn.com/wix/original/3X/3/c/3c0d0159a3d4abf48127bcff63ac1ef8cb820386.jpeg "Wix Code: Creating Filter Buttons | User Input Table") ](https://www.youtube.com/watch?v=-nMeGbXAdrc)

[https://www.wix.com/code/home/forum/advanced-tips-tricks/let-users-filter-data-in-a-table](https://www.wix.com/code/home/forum/advanced-tips-tricks/let-users-filter-data-in-a-table)

Right now I don’t believe that a table can be sorted, but it can be filtered using user input fields like drop downs. Those fields could be populated from a .js file like in this example:  
[https://www.wix.com/code/home/example/Cascading-Form](https://www.wix.com/code/home/example/Cascading-Form)  
you can then do an on change event that changes the table results. Something like this:  
export function input item1\_change(event, $w) {  
wixData.query(‘Database name’)  
.contains(‘field key in database for home states’,$w(’ [#dropdown](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23dropdown) id’).value)  
.find()  
.then(res =\> {  
$w(’ [#table](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23table) id’).data = res.items;  
});  
}  
you can keep a static sort on the table by going manage data set and sort at the bottom.

---

<div class="post-metadata">

**Author:** ![\_matt-7](https://avatars.discourse-cdn.com/v4/letter/_/ed8c4c/32.png) [@\_matt-7](https://forum.wixstudio.com/u/_matt-7)\
**Post date:** [May 4, 2018, 12:50am UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/5 "2018-05-04T00:50:58Z")

</div>

thank you!

---

<div class="post-metadata">

**Author:** ![elizabethjhay](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@elizabethjhay](https://forum.wixstudio.com/u/elizabethjhay)\
**Post date:** [May 4, 2018, 1:07am UTC](https://forum.wixstudio.com/t/table-using-user-input-data/35663/6 "2018-05-04T01:07:28Z")

</div>

You are welcome! Let me know how it works out.
