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?
Matt do you want the user to be able to sort it or do you want to have a set sort on the table?
yes, the user to sort
Try these two resources. They worked for me when I had a table on my site.
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
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 id’).value)
.find()
.then(res => {
$w(’ #table id’).data = res.items;
});
}
you can keep a static sort on the table by going manage data set and sort at the bottom.
thank you!
You are welcome! Let me know how it works out.