Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

how do you do in browser sorting with a plain old html table?


<table class="sortable">

Adding the “sortable” class to a <table> element provides support for sorting by column value. Clicking the column headers will sort the table rows by that column’s value. Tables must use <thead> and <th> tags for sortable functionality to work.


The hell? Did you copy and paste this from WordPress docs? That has nothing to do with native html functionality.


Now that your <table> element has the class "sortable," what are you going to do to actually make it sortable?


This is a copy and paste of the snippet google shows from https://www.bu.edu/tech/services/cccs/websites/www/wordpress... if you search for “sortable table”. The page is actually talking about how to author pages on their Wordpress site, which presumably uses a wordpress plugin to provide the JavaScript necessary to make this work.


this is not native browser behaviour and will only work if you include a JS lib that provides this functionality based on a classname of "sortable"


I'm assuming that is with this react project. The OP was asking why this project is needed at all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: